我无法上传我的 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!