Hello!
Here are 7 different solutions that could fix the issue:
1. Make sure you don’t add very large images.
2. If this happens after installing a new plugin, deactivate it and try again.
3. Increase your PHP memory: Add this code: define('WP_MEMORY_LIMIT', '64M')
into your wp-config.php file. If you aren’t familiar with this at all, please ask someone for help, don’t do it yourself. Also, some hosting companies don’t allow you to increase this value, so check with them first, so you know if the change will take place or not.
4. Add one of these codes in .htaccess:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
or
# Exclude the file upload and WP CRON scripts from authentication
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>
or
AddType x-mapp-php5 .php
(at the very top of your .htaccess file)
Again, if you’re not familiar with this, ask for help, or you might damage your site if it’s not done properly.
5. Make sure the hosting company uses PHP 5.2.4+.
6. Make sure you don’t have an apostrophe in the file’s name (e.g. john‘s-dog.jpg).
7. If you’re using an image optimization plugin, especially EWWW Optimizer, disable the optimization on upload feature, or deactivate the plugin completely, and try again.
If you have an image optimization plugin, I’d start with that.
You don’t have to implement all these fixes at the same time; one of them should do the trick, so try them one by one in whatever way you want.
If nothing helps, I suggest contacting your hosting company.