Link to home
Start Free TrialLog in
Avatar of skylabel
skylabel

asked on

uploading files larger than 4mb

hi,
I've got a file upload script which seems to work fine for anything under 4mb....But for anything over, it doesn't. I did a bit of searching on the net and found out it may be my webhost server settings....When I type phpinfo, the following relevant values i s what I get..
                                  local value      master value
upload_max_filesize     20M                4M
post_max_size              8M                 8M

I've added the following lines to the .htaccess file in the upload dir to try to over-ride the server....
php_value max_execution_time 600
php_value upload_max_filesize 20M
php_value post_max_size 20M

But still no files larger than 4mb...Is that upload_max_filesize 4M the culprit? And is there nothing I can do about it?

Thanks....
Avatar of armoghan
armoghan
Flag of Pakistan image

the abstract from last link

To upload large files, besides setting upload_max_filesize, you must also set post_max_size in php.ini or using ini_set() function. Keep the value to more than the maximum expected size of the upload. This is because, you may be sending other post data along with the upload file. For example:

post_max_size = 601M

This should be a safe setting if you want to upload files of around 600 MB (as specified by upload_max_filesize = 600M)

While uploading large files, you should also increase the values for max_execution_time  and max_input_time directives. Else your script will timeout or timeout before being able to parse the entire input/uploaded data.
Avatar of skylabel
skylabel

ASKER

ok...I've tried adding the following lines to my script, to no avail

ini_set ( 'upload_max_filesize', '20M');
ini_set('max_input_time', -1);

Also, as said above, I've added these lines to an htaccess file...
php_value max_execution_time 600
php_value upload_max_filesize 20M
php_value post_max_size 20M

Also added a hidden field like so
<input type='hidden' name='MAX_FILE_SIZE' value='500000'>

Is there a way I can find out what the 'limiting' factor is? I was just wondering if it could be the 'master value' for upload_max_filesize, which presently shows as 4M....And it is the cut off point....It seems no matter how large a file I try to upload, it fails at about the same time, regardless of whether the file is 5mb or 10mb....
Have you restarted Appache ?
For bigger files better would be to use FTP.
ASKER CERTIFIED SOLUTION
Avatar of armoghan
armoghan
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial