Solved

uploading files larger than 4mb

Posted on 2004-09-12
6
491 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

623 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