"An error occurred in the upload. Please try again later" in wordpress when uploading images to editor

I found a simple solution. If you save the post you are working on as a draft, then attempt the upload again, it works. This appears to happen if you have been drafting a document for a long time, without manually saving. Once you manually save, it resets the upload ability somehow, and the problem goes away.


Sometimes this problem comes with uploading/restoring the db-backup from file via phpmyadmin. The import can skip adding auto_increment to wp_posts and wp_postmeta tables at 0 key.

This leads to crash in the further work of the site and eventually you wan't be able to add new posts/pages ("you are currently editing the page that shows your latest posts" instead of the text editor), upload new images (you'll see the empty window where once was all your image gallery).

The issue can be easily fixed by deselecting the checkbox near the "Do not use AUTO_INCREMENT for zero values" when importing DB through import section of phpmyadmin. However, it still can be imported with errors and you'll need to add auto_increment to wp_posts and wp_postmeta tables manually after the import complete.

screenshot


Turns out the culprit was imagemagick. I disabled it in php.ini and everything started working again. If your host supports it you can use a custom php.ini file.

Tags:

Wordpress