Page 1 of 1

file upload problem

Posted: Wed Mar 11, 2009 5:10 am
by susrisha
1. I have a form to upload a file of size more than the limit specified in php.ini(Say 2MB)
2. I have created a php.ini in the same directory to overwrite the specifications in the directory.(say 12MB)
3. I have created an upload form and tried to upload the file a file of higher size(say 5MB)
4. I get an error 2 ($_FILES['uploadedfile']['error'])

How do i resolve this problem?

Re: file upload problem

Posted: Thu Mar 12, 2009 2:48 am
by jaoudestudios
In the php.ini file there are a few locations you need to modify.

Something like this...
upload_max_filesize
post_max_size

Re: file upload problem

Posted: Thu Mar 12, 2009 2:49 am
by jaoudestudios
Do you have enctype="multipart/form-data" in your form tag?

Re: file upload problem

Posted: Thu Mar 12, 2009 2:54 am
by susrisha
yes i did..
and i think i found out the problem.

in the uploading form i had a hidden field

Code: Select all

 <input type="hidden" name="MAX_FILE_SIZE" value=1000000/> 
This was initially put for verification on client side. But i see that the latest php versions also check for this field by default and if the uploaded file exceeds this limit, it will bounce back this error.

And FYI , i have increased both the max_file_size as well as the post data maximum size to 20MB. So no issues there.