【发布时间】:2014-08-22 07:29:07
【问题描述】:
我有一些遗留代码,在我的一生中我无法理解为什么它突然停止工作。
非常基本的上传脚本:
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 它们都是空的。
以前有人遇到过这种情况吗?任何帮助将不胜感激!
【问题讨论】:
-
你有什么错误?代码是否回退到您的错误消息之一?
-
检查使用 if(isset($_POST)) { print_r($_FILES); },如果你正在获取文件
-
嗨,正如我的帖子中提到的,$_POST 和 $_FILES 上的 print_r 返回一个空数组,所以我也没有收到提交按钮。
标签: php file-upload upload