简体   繁体   中英

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM