Frage

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?

War es hilfreich?

Lösung

Thanks for ALL YOUR HELP guys. :P

I solved it - Missing line in PHP.INI:

file_uploads = On

Just for anyone who fins this.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top