upload.html:
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input name="userfile1" type="file" /><br />
<input type="submit" value="上传" />
</form>
</body>
upload.php:
<?
$uploaddir = 'uploads/'; //上传的目录
if(!is_dir($uploaddir)){mkdir($uploaddir,0777); }
$uploadfile1 = $uploaddir.$_FILES['userfile1']['name'];
if($_FILES['userfile1']['name']!=""){
move_uploaded_file($_FILES['userfile1']['tmp_name'], $uploadfile1);
}
?>
温馨提示:内容为网友见解,仅供参考