我无法上传我的PDF文件,即使我已尝试过谷歌的一些提示。
但是,我的PHP上传仍然无法正常工作。我已将文件夹权限更改为777
。
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="3500000" />
Upload File: <input name="uploadedfile" type="file" />
<input type="submit" value="Upload File" />
</form>
$target_path = "/home/jeinqa/www/apps/upload/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else{
echo "There was an error uploading the file, please try again!";
}
显示:
There was an error uploading the file, please try again!
尝试使用print_r($_FILES);
:
Array ( [uploadedfile] => Array ( [name] => SOP-31 KW-HDR81BTJD.pdf [type] => [tmp_name] => [error] => 2 [size] => 0 ) ) There was an error uploading the file, please try again!
答案 0 :(得分:1)
<强>更新强>
你的档案很大!只需更改最大尺寸! 有关详细信息,请参阅http://php.net/manual/en/features.file-upload.errors.php。
您的错误:价值:2;上传的文件超出了HTML表单中指定的MAX_FILE_SIZE指令。