By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Maximum file size that can be handles with a PHP script

P: n/a
Hi,

I am currently trying to debug a script written by my predecessor.
Basically I have an HTML form that is used to upload a file that is
then processed using a PHP script. It has been in frequent use but I
have just been contacted because there is a PDF document that is not
uploading.

I reckon it may have something to do with the file size. All the
previously uploaded files are relatively small (<2MB) but this one is
about 5MB. When I try to upload the file using the script, which I know
uploads the file as it has been in use frequently in the past and I
have tested it with other files, it appears to reject it. When I do the
following (before any processing when the form has been submitted):

echo $_FILES['file']['size'];

....it returns zero (0) indicating that something has gone wrong
although when I do the following:

echo $_FILES['file']['name'];

....it returns the name.

I have tried including a hidden HTML form element MAX_FILE_SIZE and
setting it to exceed the file size (in bytes) but still no luck. Could
it maybe be something in the files content?

Burnsy

Jul 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rik
bizt wrote:
Hi,

I am currently trying to debug a script written by my predecessor.
Basically I have an HTML form that is used to upload a file that is
then processed using a PHP script. It has been in frequent use but I
have just been contacted because there is a PDF document that is not
uploading.

I reckon it may have something to do with the file size. All the
previously uploaded files are relatively small (<2MB) but this one is
about 5MB. When I try to upload the file using the script, which I
know uploads the file as it has been in use frequently in the past
and I have tested it with other files, it appears to reject it. When
I do the following (before any processing when the form has been
submitted):

echo $_FILES['file']['size'];

...it returns zero (0) indicating that something has gone wrong
although when I do the following:

echo $_FILES['file']['name'];

...it returns the name.

I have tried including a hidden HTML form element MAX_FILE_SIZE and
setting it to exceed the file size (in bytes) but still no luck. Could
it maybe be something in the files content?
Check your phpinfo();
post_max_size & upload_max_filesize

ini_set('post_max_size','16M');
ini_set('upload_max_filesize','16M')

Grtz,
--
Rik Wasmus
Jul 18 '06 #2

ronverdonk
Expert 2.5K+
P: 4,258
However, some hosting providers do not allow you to change the post_max_size and upload_max_filesize!
Also, post_max_size should be bigger than upload_max_filesize, otherwise you will not be able to report the correct error in case of a too big upload !
Also check the max-execution-time (upload-time could be added to execution-time.

I all fails I suggest that you look at the 2-part Vince Barnes tutorial on uploading. The link to that tutorial is:
http://www.htmlgoodies.com/beyond/ph...le.php/3472551

Good luck - Ronald :cool:
Jul 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.