Solved

uploading files larger than 4mb

Posted on 2004-09-12
6
479 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP installation issues 11 60
Advice and best practice  SQLite3 Database using PHP 2 47
PHP and google maps 13 44
paypal ipn url 5 57
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

770 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