简体   繁体   English

Max_File_Uploads指令php.ini

[英]Max_File_Uploads directive php.ini

Im trying to do a simple file upload. 我试图做一个简单的文件上传。 I've done it many times before and it's been fine. 我已经做过很多次了,一切都很好。 For some reason this time I keep getting error UPLOAD_ERR_INI_SIZE coming up. 由于某种原因,这次我不断收到错误消息UPLOAD_ERR_INI_SIZE Even though i've uploaded bigger files on the same server before. 即使我之前在同一台服务器上上传了较大的文件。 Here is my PHP.INI: 这是我的PHP.INI:

display_errors = On
short_open_tag = On
memory_limit = 32M
date.timezone = Europe/Paris
upload_max_filesize = 10M
post_max_size = 10M

And my HTML form: 而我的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>

And my code: 而我的代码:

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."); 
                    }
                }

The only difference this time is that I am resizing and genorating thumbs with the temporary upload file instead of copying over the file first. 这次的唯一区别是,我正在使用临时上传文件调整大小和生成缩略图,而不是先复制文件。 Could that be the problem? 这可能是问题吗? I dont think so, because if the image is small it works perfectly fine. 我不这么认为,因为如果图像很小,则效果很好。 But I try anything like 2mb and it throws a fit. 但是我尝试2mb之类的方法,结果很合适。

Suggestions? 有什么建议吗?

Thanks for ALL YOUR HELP guys. 感谢您的帮助。 :P :P

I solved it - Missing line in PHP.INI: 我解决了-PHP.INI中缺少行:

file_uploads = On

Just for anyone who fins this. 只为那些发现这一点的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM