WebDevKev
WebDevKev

Reputation: 285

Can't upload file greater than 2MB via PHP script

I have a form that asks the user to submit a photo. However, if the user tries to upload a file greater than 2MB, the results are emailed as expected but no photo is uploaded. While troubleshooting, I noted that I'm getting an error UPLOAD_ERR_INI_SIZE.

I added the following to my php.ini, and verified with phpinfo() that the values are being loaded correctly.

upload_max_filesize = 34M
post_max_size = 64M
max_execution_time = 300
max_input_time = 320
memory_limit = 128M

Am I missing something? I've verified that a file sized at 1.4MB works fine, but a 4.2MB file fails.

Upvotes: 1

Views: 2136

Answers (1)

WebDevKev
WebDevKev

Reputation: 285

I found out that the setting in WHM was overriding the php.ini file in my site's root directory. To fix it, I went to WHM, searched for PHP Configuration Editor, changed the upload_max_filesize to 32M, and clicked Save.

Thanks so much to @samaYo and @Dagan for helping me and eventually leading me in the right direction to get it solved!

Upvotes: 1

Related Questions