Upload max size in PHP?
Asked Answered
S

5

8

Is it possible for the upload of ~100 MB files using PHP?

If so, what changes need to occur in the configuration file (php.ini)?

Sri

Statuesque answered 16/7, 2010 at 9:20 Comment(3)
"possible" !== "good idea"Trichloride
@symbcbean I'd say that really depends, doesn't it? If you have a public-facing upload interface of some sort and you can't use FTP...Benzoin
Does this answer your question? Changing upload_max_filesize on PHPCrush
B
30

The following options are relevant:

and possibly

Benzoin answered 16/7, 2010 at 9:22 Comment(0)
A
2

In your php.ini adjust the value of:

file_uploads = On
upload_max_filesize = 100M //needs to be in {x}M format

And allow larger post size:

post_max_size = 100M
Anal answered 16/7, 2010 at 9:21 Comment(0)
C
2

To allow for larger uploads with PHP you must change a few settings in the php.ini file (upload_max_filesize, max_input_time, memory_limit, max_execution_time, post_max_size). You can find your php.ini file under you PHP installation directory, and more information about the required settings here.

Cyclopean answered 16/7, 2010 at 9:26 Comment(1)
Thanks for reminding me of max_input_time, +1. But max_execution_time and memory_limit don't really apply - not if the uploaded file is merely moved to another location.Benzoin
N
1

This dumfounded me for a while so just wanted to add:

If your project also use nginx (e.g. a buildpack), you may have to add client_max_body_size 100M; to your nginx.conf file since nginx defaults to only 1M (1 MB) - in addition to the PHP settings mentioned above.

Regarding PHP settings, I create a .user.ini file at root level of my projects to change the few settings I want to override from the default php.ini file.

In my setup (using dokku) it was located at /etc/nginx/nginx.conf, then added the extra line via nano nginx.conf. I don't directly use nginx, but my buildpack adds it.

Hope this helps someone :)

Nanon answered 19/4, 2019 at 19:47 Comment(0)
S
0

You just need to change the timeout of the server and the max file size in the php.ini file.

http://blog.jc21.com/2007-05-03/change-the-maximum-upload-size-with-php/

EDIT: You may not need to change the timeout of the server as that really would depend on which server you are running things on.

Solitary answered 16/7, 2010 at 9:22 Comment(2)
Upload time does not count toward the execution time.Benzoin
@Benzoin yeah I was just thinking about that after I wrote it and that is why I added the edit.Solitary

© 2022 - 2024 — McMap. All rights reserved.