试图从html表单上传pdf

时间:2015-06-16 09:48:11

标签: php html

我在这里尝试从html表单上传PDF文件。但该文件未上传。

HTML文件:

<form action="Upload.php" method="post" enctype="multipart/form-data">                  
    <input type="file" name="fileToUpload"  accept="application/pdf" id="fileToUpload">
    <input type="submit" value="Upload" name="submit">
</form>

Upload.php文件:

move_uploaded_file ($_FILES['fileToUpload'] ['tmp_name'], "uploads/{$_FILES['fileToUpload'] ['name']}");

2 个答案:

答案 0 :(得分:0)

检查您是否在根目录中创建了“upload”文件夹。

答案 1 :(得分:-1)

在upload.php中修改

&#13;
&#13;
move_uploaded_file ($_FILES['fileToUpload'] ['tmp_name'], "uploads/".$_FILES['fileToUpload'] ['name']);
&#13;
&#13;
&#13; 还要检查上传文件夹的权限为777