Page 1 of 1

Increase the Upload size

Posted: Thu Apr 27, 2006 5:00 am
by lawrence_chtan
Greeting to all the guru

I had gone thru all the google search. wonder i miss up any point

My problem:

by default PHP only accept 2MB of data upload size to the Webserver

and notice from the Google search. We just need to change the php.ini. the max_upload_size=2MB but the strange part is. after i restarted the computer. In order to let my OS recognised the php.ini

I still cannot exceed the 2MB. the filesize i gonna upload is about 5.6MB

I m testing it on my XP machine and as well my VM of Win2003, with IIS and MySQL

Lawrence

Posted: Thu Apr 27, 2006 5:42 am
by shiznatix
did you make sure your MAX_UPLOAD_SIZE in your HTML form is big enough to allow your file through?

Posted: Thu Apr 27, 2006 7:01 am
by Oren
Check your max_execution_time as well.

Posted: Thu Apr 27, 2006 7:10 am
by dibyendrah
edit the php.ini and make sure the upload_max_filesize and post_max_size has the value you wanted.

Code: Select all

; Maximum allowed size for uploaded files.
upload_max_filesize = 16M

; Maximum size of POST data that PHP will accept.
post_max_size = 16M

After changing the php.ini, save it and restart the apache web server to see the effect.

Cheers,
Dibyendra

Posted: Thu Apr 27, 2006 9:59 am
by themurph
I believe you can embed those directives within a php page itself as well.

That way, you can effect the change only on those pages that might require it.

Posted: Thu Apr 27, 2006 10:05 am
by feyd
That can only partly affect the handling. The php directives must be large enough to handle it before the in-page directive is considered.

Posted: Thu Apr 27, 2006 10:16 am
by themurph
Feyd, Is this true of the memory_limit directive?

I could swear awhile back I had a script that was bombing until I put the
directive ini_set("memory_limit","20M"); in it.

(The php.ini setting was the default 8M)

Increase Maximum Upload Size

Posted: Thu Apr 27, 2006 12:45 pm
by manjeet
create a .htaccess file and write max_upload_size=2MB.

Posted: Thu Apr 27, 2006 4:46 pm
by feyd
memory_limit affects how much RAM each page request can use. It does not affect uploads. It would affect handling of images if you are loading them with GD however.

via ini_set

Posted: Fri Apr 28, 2006 2:34 am
by dibyendrah
Dear all,

Can we set the memory limit via ini_set() at run time accroding to the upload size ?

Dibyendra

Posted: Fri Apr 28, 2006 8:21 am
by feyd
Unless you're loading the uploaded file into memory, there's little point in fiddling with the memory limit.

Yes, it can be altered, at run time, in the script. If you want to know what directives can be altered where, read the ini core directives page.