Solved

uploading files larger than 4mb

Posted on 2004-09-12
6
473 Views
Last Modified: 2008-03-06
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....
0
Comment
Question by:skylabel
  • 5
6 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 12041485
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12041494
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.
0
 
LVL 1

Author Comment

by:skylabel
ID: 12052022
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....
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 18

Expert Comment

by:armoghan
ID: 12052771
Have you restarted Appache ?
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12052778
For bigger files better would be to use FTP.
0
 
LVL 18

Accepted Solution

by:
armoghan earned 500 total points
ID: 12052802
if you have set it in htAccess file you do not need to do this in your php script
ini_set ( 'upload_max_filesize', '20M');


check the size in script
$data = ini_get( 'upload_max_filesize' );
echo $data;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now