0
votes

I know there are many questions about Request Entity Too Large on internet but i could not find right answer for my problem ;)

I`m using HTML file input tag to let users upload their images .

<input type = 'file' class = 'upload-pic' accept='image/*' id ='Fuploader' name = 'pro-pic'><br>

There is nothing wrong with files less than 2 MB which is allowed by my site

But the problem is if some one decide to upload larger file like 5.10 MB , i can handle it by php and warn user that this file is too large

if($_FILES['pro-pic']['size'] > 2000000)
{
    die("TOO LARGE");
}

But my problem is by uploading 5.10 MB file , Request entity too large error will be lunched and rest of my php code won`t work

I have checked post_max_size and upload_max_filesize they are both set to 8MB But i get Error on 5.10MB !

And I need to find way to handle files even larger than 8MB because there is no way to guess what user may try to upload ;) and i don`t want them to get dirty and broken page because of REQUEST ENTITY TOO LARGE ERROR

Is there any way too fully disable this Error Or set upload_max_filesize and post_max_size to infinity ?

1
On a programming note, die is not informing your users properly: it just kills the script process with an stdout message. Do not use die if you want to let your users know what's going on. - Mike 'Pomax' Kamermans
Yes you are right but it is just simplified form of my script to just describe the problem ;) my problem is Request entity too large kills my php script not my die() - mr programmers dasasdasd

1 Answers

0
votes

You need to set SecRequestBodyAccess Off.

Check the link i have given ..it would help you

https://serverfault.com/questions/402630/http-error-413-request-entity-too-large