用于大型(ish)文件上载的空FILES数组

时间:2014-08-22 07:29:08

标签: php file-upload upload

我有一些遗留代码,在我的生活中,我无法理解为什么它突然停止工作。

非常基本的上传脚本:

if($_FILES['csvfile']['name']){
    //if no errors...
    if(!$_FILES['csvfile']['error']){
        //now is the time to modify the future fle name and validate the file
        $new_file_name = strtolower($_FILES['csvfile']['tmp_name']); //rename file


       //move it to where we want it to be
       move_uploaded_file($_FILES['csvfile']['tmp_name'], 'active_leads1.csv');
       //echo 'Congratulations!  Your file was accepted.';

    }else{
      //set that to be the returned message
      //echo 'Ooops!  Your upload triggered the following error:  '.$_FILES['csvfile']['error'];

       die("Unfortuanatly there was an error: {$_FILES['csvfile']['error']}");
   }
}else{
    die("Unfortuanatly there was an error: ".print_r($_FILES,true)."");

}

同样,表格同样基本:

<form action="csvconvert.php" method="post" enctype="multipart/form-data">
 <input type="file" name="csvfile" size="25" />
 <input type="submit" name="submit" value="Submit" />
</form>

然而,它在文件c上失败了。 11MB。较小的文件没问题。

检查了帖子限制和上传限制,两者都很好(256M和128M),最大输入时间是240,然而如果我print_r $ _POST和$ _FILES它们都是空的。

有没有人遇到过这个?任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

如果较小的文件没问题,您确定upload_max_filesize大于11MB吗?使用upload_max_filesizeecho phpinfo();的价值是多少。