We help IT Professionals succeed at work.

PHP & HTTP file upload ... size limit?

hagur
hagur asked
on
Hi ... I've created a video gallery system where users can create a video gallery and upload video files to the galleries.  The problem is that I cannot seem to be able to upload files after they reach a certain size ... I cannot upload 1mb files but I can upload ~400 kb files.
So the limit is somewhere there between.

I'm just using INPUT TYPE=FILE in a form with enctype="multipart/form-data".

The php file which the form submits to simply takes the name of the variable and uses the copy function to copy it to it's destination.

Is this a limit with PHP or the HTTP standard? Or maybe is this a configuration somewhere in the web server?

This has to be possible ....

Comment
Watch Question

Commented:
this is what i got from some site

By default PHP limits the file size a user can upload so that a user cannot fill the temp space, to increase the file size limityou need to edit your php.ini (/usr/local/lib) to increase the value  of the following line

upload_max_filesize = 2097152


hope this will help


Lk:)
Top Expert 2005

Commented:
You've also need to add a hidden-field to the form:

<input type="hidden" name="MAX_FILE_SIZE" value="2000000">

This is the max-file size for uploads in byte.

If your still having problem, you have to check the configuration of your webserver.

Batalf
Top Expert 2005

Commented:
lokeshv : We were writing at the same time.

Commented:
Assuming you run apache as your web server; you can set the filesize limit in php.ini AND in httpd.conf.

filesize limits (post_max_size) in php.ini are usually around 4 or 8 MB, so i think the limit is in your web server configuration. However, I don't know how to resolve this with apache.
Commented:
ok back with some more useful things,

haqur
Check the upload_max_filesize setting
in the php.ini file. This is usually set at 2 Megabytes on default installs
of PHP. The smaller of these two settings determine the maximum
file size that may be uploaded. If this does not solve the problem see the
following. Also check the post_max_size setting in php.ini. This should be larger
than the maximum files size you wish to upload.

You may need to increase the
memory_limit setting in the php.ini file.
This should be set to the largest file you will be uploading.

Large file uploads fail with a timeout error message.

Increase the max_execution_time setting in the php.ini file. This limits
the length of time that a PHP script may execute. This and the connection
speed determine the maximum file size that may be uploaded. For example
at a connection speed of 25 Kilobytes / second the default max_execution_time
setting of 30 seconds would allow a 3/4 Megabyte size file to be uploaded
before timing out.

And last but Most Important don't forget to RESTART your webserver.

Hope it solves

Lk:-)

Author

Commented:
Thanks guys, I'll try this out as soon as I can!

Author

Commented:
Thanks!

This seems to have solved my problem.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.