<html>
<head><title>php 文件上传简单实例应用</title></head>
<body>
代码如下 | 复制代码 |
<!-- 表单的enctype属性必须指定为multipart/form-data --> <form enctype="multipart/form-data" action="3.php" method="post"> 上传此文件: <input name="myfile" type="file" /> <input type="submit" value="提交上传" /> </form> </body> |
3.php文件
代码如下 | 复制代码 |
<?php //将文件移至服务器的根目录的upload目录下,upload事先得建立好 $upload_path = $_server['document_root']."/upload/"; $dest_file = $upload_path.basename($_files['myfile']['name']); if(move_uploaded_file($_files['myfile']['tmp_name'],$dest_file)) |
时间: 2024-09-20 06:14:46