doushe2513 2013-07-18 17:35
浏览 49
已采纳

Max_File_Uploads指令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. Even though i've uploaded bigger files on the same server before. Here is my 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:

<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.

Suggestions?

  • 写回答

1条回答 默认 最新

  • dongtuliao6760 2013-07-18 18:54
    关注

    Thanks for ALL YOUR HELP guys. :P

    I solved it - Missing line in PHP.INI:

    file_uploads = On

    Just for anyone who fins this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。