I have a project that I am working that has a collection containing a number of folders that each render a different gallery when a label is clicked on. The issue that I am having is that I cannot upload any images that are 1mb or over. All of the kb images upload just fine, but the minute something is 1mb, it simply does not upload. The error message says: file(s) failed to upload.
This is not a permission issue, because I am able to upload files under 1mb. Can someone please point me toward a solution. Been searching and searching and I just for the life of me cannot figure out what the issue is. Thank you all in advance! I appreciate the help!
For future people who come upon this post looking for a solution, here is how I solved it.
Change the settings in php. I am using cpanel, so I changed the settings in “select php version” then click “switch to php options” then
increase post_max_size and upload_max_filesize
I had this same error. In case anyone finds this, let me add my two cents as well.
Unfortunately, the error I got within Cockpit simply said “Something Went Wrong” while i was uploading a file. Not very helpful.
I went to my Nginx error log file and saw this message:
*10899 client intended to send too large body: 3082436 bytes, client: <IP address>, server: <myserver.com> request: “POST
This means that I am trying to upload a file that is too large. I am uploading a 3M+ image and it is too large.
There are many places in your configuration that restrict upload limits. You can only upload a file as large as the smallest limit. So if your
php.ini file is set to 100Mb, but your Nginx is only set to 2Mb, then you can only upload 2Mb.
So you need to make sure all the places are set to what you want.
Here is a list to check:
- In your
- In your nginx.conf
- In your
/etc/nginx/sites-available/ you might have another configuration file overwriting the general nginx.conf so change it there too.
client_max_body_size 20M in your server block somewhere (but outside of a location block)
Now you can restart BOTH php-fpm if you updated the php.ini file, AND restart Nginx if you changed stuff there, for it to take place. If you still have problems, maybe restart your whole server to make sure everything “takes”.
On ubuntu you can
service nginx restart and
service php-fpm restart. Depending on your system, the php-fpm might not work because it is locked to a version of php. So instead use
service php7.3-fpm restart (obviously rotate out your specific php version if you are using something other than 7.3.
Hope that helps. Uploads start working.