Fixing WordPress error: An error occurred in the upload. Please try again later

I’ve been spending a considerable amount of time in fixing the WordPress error:¬†An error occurred in the upload. Please try again later. I received this error when trying to add image upload functionality to my own custom plugin.

I had a hard time debugging and first focussed on the Javascript. Unfortunately I couldn’t find the cause of the error and nearly gave up.

Then I remembered the obvious. The media upload element uses Ajax for uploading and return information about the uploaded image.

I assume you have WP_DEBUG = true in your config file, if not, make sure to add it to wp-config.php.

After that, use FireFox or Chrome developer tools and monitor the Ajax requests. You’ll notice requests to admin-ajax.php and async-upload.php. By looking at the responses the error was obvious, there was a conflict with (in my case, the custom permalink plugin) which gave me notices in the Ajax response. When I changed some code, it was solved and uploading media worked great!

So if you want to debug the mentioned issue, then make sure to monitor the Ajax requests, you might find the cause. Good luck and feel free to ask in case you need help!

This entry was posted in Wordpress and tagged , . Bookmark the permalink.

2 Responses to Fixing WordPress error: An error occurred in the upload. Please try again later

  1. Joshua Riggs says:

    I am having this issue but I don’t know how to debug like you mention.
    I have deactivated all plugins and reinstalled WordPress 3.6 but I still can’t upload images or set a featured image.
    I’m using a customized Webfolio theme.
    Can you help?

  2. Jan Willem says:

    What browser do you use Joshua, and did you find a way to monitor the Ajax requests? That’s essential to find a way to fix it.

Comments are closed.