PHP attachment file size limit??

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

PHP attachment file size limit??

Post by cah »

I was trying to attach some pictures from last week's JDRF walk but some of the files failed to upload to phpbb3.

It complained:
The image file you tried to attach is invalid.
After a few tests, I found it was caused by file size.
For those over 2 MB pictures, it will show the above message.

I have set the max attachment file size to be unlimited but it still bombs out when files are over 2 MB.

After reading some of the posts on the internet, this is not a limitation of PHPBB3.
Instead, it is the limit of PHP.

Try to modify the following entries in /usr/local/lib/php.ini:

Code: Select all

; Maximum allowed size for uploaded files.
upload_max_filesize = 5M (it was set to 2M)
After changing the upload max filesize, I was able to upload files larger than 2 MB.
CAH, The Great
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

Re: PHP attachment file size limit??

Post by cah »

Increase the max upload file size from 5M to 10M

Note: a restart of Apache is needed to take effect
CAH, The Great
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

Re: PHP attachment file size limit??

Post by cah »

There are two size settings in php.ini:

Code: Select all

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

; Maximum allowed size for uploaded files.
upload_max_filesize = 10M
One classmate tried to upload a 9 MB file and failed.
It is apparently limited by post_max_size.
However, I never touched this setting before.
All I changed was upload_max_filesize from 2MB to 5MB to 10MB.

Maybe these two settings should match.
CAH, The Great
Post Reply