[英]Max_File_Uploads directive php.ini
我试图做一个简单的文件上传。 我已经做过很多次了,一切都很好。 由于某种原因,这次我不断收到错误消息UPLOAD_ERR_INI_SIZE
。 即使我之前在同一台服务器上上传了较大的文件。 这是我的PHP.INI:
display_errors = On
short_open_tag = On
memory_limit = 32M
date.timezone = Europe/Paris
upload_max_filesize = 10M
post_max_size = 10M
而我的HTML表单:
<form action="/settings/upload-image" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?=(1024*1024*1024);?>">
<input name="files[]" id="attachfile" type="file" />
<br /><br />
<input type="submit" class="submit" value="Upload New Profile Image">
</form>
而我的代码:
foreach($files as $file)
{ $ext = strtolower(pathinfo($file[0], PATHINFO_EXTENSION));
if(in_array($ext,$allowed_upload_ext)===TRUE)
{
if(!$file[3]) { // If no error code
//$newFile = $me['id'].".$ext";
$newFile = $file[0];
resizeImage($file[2],PROFILE_IMAGES."/".$newFile,$ext,500);
genThumbFile($file[2],PROFILE_IMAGES."/thumb/".$newFile);
runSQL("UPDATE `users` SET `image`='{$file[0]}' WHERE `id`='{$me['id']}';");
array_push($msgs,"Image uploaded successfully.");
$me = select("SELECT * FROM `users` WHERE `id`='{$me['id']}';",true);
} else {
array_push($msgs,"!".fileError($file[3]));
}
} else {
array_push($msgs,"!The file ".$file[0]." could not be uploaded as it is the wrong file type.");
}
}
这次的唯一区别是,我正在使用临时上传文件调整大小和生成缩略图,而不是先复制文件。 这可能是问题吗? 我不这么认为,因为如果图像很小,则效果很好。 但是我尝试2mb之类的方法,结果很合适。
有什么建议吗?
感谢您的帮助。 :P
我解决了-PHP.INI中缺少行:
file_uploads = On
只为那些发现这一点的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.