Php 将表单设置为上载PDF时出错

Php 将表单设置为上载PDF时出错,php,pdf,post,file-upload,Php,Pdf,Post,File Upload,我正在设置一个上传PDF的表单,但很难找出问题的根源 我在一页上有一张表格 <form enctype="multipart/form-data" action="step3.php" method="post"> <label>Select Any PDF's For This Product <br /><span style="font-size:12px; margin-left: 4px;">(Must be

我正在设置一个上传PDF的表单,但很难找出问题的根源

我在一页上有一张表格

    <form enctype="multipart/form-data" action="step3.php" method="post">
          <label>Select Any PDF's For This Product <br /><span style="font-size:12px; margin-left: 4px;">(Must be pdf format. Max file size 60MB)</span></label><br /><br />
          <input type="hidden" name="MAX_FILE_SIZE" value="60000" />
          <input name="uploadedpdf1" type="file" /><br />
          <input name="uploadedpdf2" type="file" /><br />
          <input name="uploadedpdf3" type="file" /><br />
          <input name="uploadedpdf4" type="file" /><br />
          <input name="uploadedpdf5" type="file" /><br /><br>
          <input type="submit" name="submit" value="Next Step" />
        </form>

选择此产品的任何PDF
(必须为PDF格式。最大文件大小为60MB)







然后在下一页中,我将使用一个长PHP脚本来上传和验证文件。我的问题开始于脚本的乞讨,所以我将发布一个非常简化的版本

for ($i = 1; $i < 6; ++$i) {    
$file = "uploadedpdf{$i}";

if($_FILES[$file]["name"]!="") {

$fileName = $_FILES[$file]["name"]; 
$fileTmpLoc = $_FILES[$file]["tmp_name"]; 
$fileType = $_FILES[$file]["type"]; 
$fileSize = $_FILES[$file]["size"]; 
$fileErrorMsg = $_FILES[$file]["error"]; 
}}
($i=1;$i<6;++$i){ $file=“uploadedpdf{$i}”; 如果($\u FILES[$file][“name”]!=“”){ $fileName=$_文件[$file][“name”]; $fileTmpLoc=$\u文件[$file][“tmp\u名称”]; $fileType=$_文件[$file][“type”]; $fileSize=$_文件[$file][“大小”]; $fileErrorMsg=$_FILES[$file][“error”]; }} 在这一点上,我只是得到有关上传文件的信息,看看它是否可以上传

我没有得到$\u文件[$file][“tmp\u名称”]或$\u文件[$file][“类型”]的值

$\u文件[$file][“大小”]=0

$\u文件[$file][“错误”]=2

但是$_FILES[$file][“name”]可以正常工作


为什么我的文件没有大小,如何调试这两个错误?

在访问
$\u文件中的信息之前,您应该。在您的情况下,错误2表示上载文件的大小大于POST字段
MAX\u file\u size
的数值,该字段通常设置为隐藏输入字段。检查此输入字段是否具有正确的
,或将其删除。

在访问
$\u文件中的信息之前,您应该。在您的情况下,错误2表示上载文件的大小大于POST字段
MAX\u file\u size
的数值,该字段通常设置为隐藏输入字段。检查此输入字段是否具有正确的
值,或将其删除。

文件太大。根据错误号(您可以在屏幕上看到列表):

上传错误表单大小

Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive
在HTML表单中指定的

你的是

 <input type="hidden" name="MAX_FILE_SIZE" value="60000" />

评论后编辑:


大小以字节为单位指定,因此60 MB=61440000。另外,请注意php INI设置允许这样的大小(指令*upload\U max\U filesize*),并且不会超过您的时间限制。

文件太大。根据错误号(您可以在屏幕上看到列表):

上传错误表单大小

Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive
在HTML表单中指定的

你的是

 <input type="hidden" name="MAX_FILE_SIZE" value="60000" />

评论后编辑:


大小以字节为单位指定,因此60 MB=61440000。另外,请注意php INI设置允许这样的大小(指令*upload\u max\u filesize*),并且不会超过您的时间限制。

我看到我的表单的max\u FILE\u size为value=“60000”,支持处理60MB的大小,但它一定离您太远了。您知道60MB需要什么值吗?非常感谢您的快速响应。我看到我的表单的最大文件大小为value=“60000”。支持处理60MB,但它肯定太差了。您知道60MB需要多少值吗?非常感谢您的快速响应。