HTML表單上傳文件PHP
<form name="nv" method="post" action="#" enctype="multipart/form-data">
<table>
<tr>
<td>Photo:</td>
<td><input name="photo" type="file" size="58"></td>
</tr>
<tr>
<td><input name="res" type="reset" value="reset"></td>
<td><input name="sub" type="submit" value="s'enregistrer"></td>
</tr>
</table>
</form>
PHP
$file_result = "";
if($_FILES["photo"]["error"]>0){
$file_result =" il y a un error lors de la telechargement de la photo, error : <br />". $_FILES["photo"]["error"];
}else{
$path = "C:\\Program Files (x86)\\EasyPHP-5.3.9\\www\\2011pr\photos\\";
move_uploaded_file($_FILES["photo"]["name"],$path);
$file_result = $_FILES["photo"]["name"] . " est bien telecharge a dans le serveur";
}
echo " <br /> ". $file_result." <br /> ";
它給了我這個錯誤:
Warning: move_uploaded_file() [function.move-uploaded-file]: The second argument to copy() function cannot be a directory in C:\Program Files (x86)\EasyPHP-5.3.9\www\2011pr\nouveau.php on line 129
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Program Files (x86)\EasyPHP-5.3.9\tmp\phpF33.tmp' to 'C:\Program Files (x86)\EasyPHP-5.3.9\www\2011pr\photos\' in C:\Program Files (x86)\EasyPHP-5.3.9\www\2011pr\nouveau.php on line 129
只要閱讀錯誤訊息... – Phantom