Inicio > English > Solution to: WP 3.5 “An error occurred in the upload. Please try again later.”

Solution to: WP 3.5 “An error occurred in the upload. Please try again later.”

Lunes, 23 de diciembre de 2013

Originally posted on the 28th of january 2013, updated with a new finding on december 2013.


 

UPDATE december 2013: the problem came back on 3.6 or 3.7 I dug more in the possible cause and found another possibility.

Closing PHP tags inside the functions.php file and reopening them will produce this error too… 

in my case i was using it to write html as part of a function as it is easier to escape the quotes in html than php.


If after upgrading to WordPress 3.5 you cannot insert images follow this steps:

  • Start by disabling all the plugins. (I know you already did it but bear with me)

Try now uploading.

If it worked then you have a problem with plugins (Go read  1 below)   /    If that doesn’t work, leave them disabled.

  • go to your theme folder and rename the functions.php to whatever name you want.

Try uploading now…

If it worked then you have a problem with your functions (Go read 2  below)

 If that doesn’t work neither and you are using a child theme make sure there is no functions.php on the parent theme folder

(if you don’t know what i am speaking about leave a comment and i will help you by email).

  • Still don’t work, what do I do now ?.

This problem is mainly caused by Java Script / jQuery conflicts between core WordPress and custom code you installed in your blog for plugins or functions you got from the Internet.

The implementation of Java Script in WordPress is complicated to say the least…

Java Script is difficult to troubleshoot unless you are a JS developer and then you would not be reading this…

(Go read 3 below)

1 .- PLUGINS trouble shooting:

  • You should have done this already there are plenty of posts in WP support…
  • Disable all the plugins and re-enable them one by one until the uploader breaks.
  • If disabling the plugins dont fix your uploader, Rename your Plugins folder and try to upload to see if that fixes it.

2 .- FUNCTIONS.PHP

  • Make sure you don’t have any lines with comments in HTML mark up (Example <!– I am a HTML code comment –> )
  • Make sure you open and close the PHP tags ONLY ONCE!!! in the file.

that fixed my uploader.

3.- JavaScript Problems

The reason there is not much support for this problem is because WordPress works, and the problem is coming from something you or your theme developer broke.

Lets start with some basic troubleshooting: (You have Chrome and / or Mozilla installed don’t you ? )

  • First Step: Chrome; go to the home page of your WordPress blog.

Right click anywhere on the screen and on the menu that pops click on inspect element this will open a pseudo-window  with information about your page source code etc…

In the bottom right of this window there is a cog (gear)  icon and next to it a little red circle with a white x on it, next to that usually is a number (That lists parsing errors when your page loaded.

If you have any number next to the red circle click on it to see the detail of the error.

You can ignore any Port error: bla bla (this don’t break the uploader and is another different matter).

IGNORE: Port error: Could not establish connection. Receiving end does not exist.

If you have 404 errors listed this means that you are missing some files, this is not usually the culcript but you should try to solve those because is not good anyway.

We are interested in Java Script errors usually something like this:

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method ‘widget’ jquery-ui-interactions.js:13
If you dont see anything here do your best to keep both your blog and this Developer Tools Window visible and navigate to your wp-admin page, always keeping an eye on the errors on the other window.
Try to upload and see if you get any errors.
Usually the errors that break the uploader show in the front page and not in the back-end.
What you need to do is keep an eye in the JavaScript errors in the front-end because once JS finds an error it stops executing the rest of the scripts on the page.
Last bit of advice:
The most common reason for this to happen is that someone is calling somewhere the jQuery libraries and WordPress calls its own tested version of jQuery, calling jQuery twice specially different versions slows down your page, and also can break the delicate balance of WordPress and the universe.
WordPress calls jQuery only when it needs it, and if you added somewhere in your theme or template a call to jQuery the uploader will break.
If none of these steps helped you fix your uploader drop a note here, I will try to check your site and give you some personal advice (time permits)
If I helped leave a comment it feeds my ego and makes me feel better

Author: Categories: English Tags:
  1. Olov
    Viernes, 17 de julio de 2015 a las 16:46 | #1

    Thanks for the detailed post. I’ve been having this issue for some time and just couldnt get it working. Your information plus one found here
    Please see this link for more details – it helped me https://sebastian.expert/fix-wordpress-an-error-occurred-in-the-upload-please-try-again-later/ made my site work again!!

  2. Sábado, 10 de enero de 2015 a las 23:06 | #2

    Tried all your suggestions but nothing worked. I was wondering if you could take a minute and look at the site to see if I have missed something.

    Thanks for any help.
    site: http://www.agmag.com

    Jeff

  3. Jueves, 1 de enero de 2015 a las 20:29 | #3

    Thank you so much! I was having difficulty troubleshooting this problem with a theme that I had developed. I had disabled all plugins but still had an issue — it was with custom image size code that I had copied/pasted from another developer and put in my functions.php. I always try to write my own code to avoid something like this but tried taking a short cut and ran into this problem. It caused me hours and hours and hours of troubleshooting. I posted in WordPress Forum but got absolutely no response. Thanks for posting this — I’m so happy I found it!

    • Nathan
      Jueves, 1 de enero de 2015 a las 21:16 | #4

      Glad it helps!

  4. Martes, 11 de noviembre de 2014 a las 01:36 | #5

    Hi Nathan,

    Sorry to bother you, the problem has started on a website for a local club. I have had a look at the functions.php file for my theme and everything appears to be ok. Any help you can provide would be fantastic.

    • Nathan
      Martes, 11 de noviembre de 2014 a las 13:56 | #6

      Hi Mike, in order to help i will need more info.
      On the backend have looked for errors using the deelopper tools?
      Have you tried renaming the functions php file?
      Have you moved all of your plugins out of the plugins folder?

  5. danial
    Domingo, 9 de noviembre de 2014 a las 11:54 | #7

    i try everything- and finally find out most problem because:
    1-custom template function
    2-permission host-> for upload folder
    3-and some plugin
    <!–tnx again–oPs n0 <! .:)

  6. danial
    Domingo, 9 de noviembre de 2014 a las 11:46 | #8

    w0000w man tnx alot -my problem solved with solution step 2 .- FUNCTIONS.PHP — woow you are Genius

  7. Jueves, 2 de octubre de 2014 a las 01:48 | #9

    Hello
    I stuck with media library problem for about 6 months , some googling got me here.
    some luck made me try to remove HTML Comments from Functions.php….and BooM everything work fine. wish I have more than “Thank you”, but I’m curious to know the reason.
    Thank You Very Much rockdio

  8. Marius
    Jueves, 25 de julio de 2013 a las 16:44 | #10

    Hello
    I have same problem. I rename functions.php and it works. I delete all bad code, now I have this:

    But if I rename ……still not work.
    What should I do? Thanks

  9. Lunes, 22 de julio de 2013 a las 17:59 | #11

    Thank you for the tip – I was able to see what the error is. But I am unable to fix it – it shows “Blocked a frame with origin “http://www.youtube.com” from accessing a frame with origin “http://spiritsinthemix.com”. Protocols, domains, and ports must match.” I’ve gotten this a couple of times any chance you could help? Thank you

  10. Matt Rogers
    Jueves, 20 de junio de 2013 a las 15:33 | #12

    Hi– Thank you so much for writing this article. Unfortunately, I’m still going crazy trying to track down this problem. I followed all of your troubleshooting steps.

    I disabled all plugins, changed to the original Twenty Twelve theme, fixed up the multiple open-closed PHP tags in my theme’s functions.php, searched for javascript errors — no dice. There are no JS errors, and reverting back to default everything does not fix the issue (this is a fresh install, by the way, as of last week). However, I noticed that this only happens when I’m uploading large files — 5 or 6MB. Images that are a few hundred KB work fine. I’ve upped my server’s limit to 64MB (from its original 7MB), but the error still occurs.

    In my case, it certainly seems to be server-related since smaller images work fine. But I’m unsure what other config values on the server I should check.

    • Nathan
      Jueves, 20 de junio de 2013 a las 15:36 | #13

      Take a look at your errors.log and use phpinfo() in a page on your server to see what other php values can be upped…

  11. Miércoles, 5 de junio de 2013 a las 18:58 | #14

    Thank you so much! I had a problem with a file included in functions.php, specifically, an HTML comment. Your suggestion saved me a huge headache, and I really appreciate you posting your solution on the WordPress website.

    Found it here: http://wordpress.org/support/topic/35-an-error-occurred-in-the-upload-please-try-again-later

    -Technically Smart Guy

    • Nathan
      Jueves, 6 de junio de 2013 a las 05:22 | #15

      Glad it helped Julian!

  12. Domingo, 28 de abril de 2013 a las 14:37 | #16

    Hi there
    I found your post and have tried all of these options. I have deactivated all of my plugins, changed the media folder, updated permalinks, changed to the twenty-twelve theme, and renamed my functions.php. None of thes work. In addition, weird other things are happening: when I add content to a widget area, for example a text box, the box jumps so that you can’t enter any content, so you click Save, then you can enter content. Also, when I add items to any menu, a weird number appears not in the menu but at the bottom of the menu list but then goes away after you click save. When I upload media, I get the error mentioned above in a red box, but after I x out I can go back in and it IS in my media library. I did not do the original theme or WordPress install. Any other suggestions? Could it be the hosting? Thank you for any help JC

    • Nathan
      Jueves, 6 de junio de 2013 a las 05:26 | #17

      Jennifer, I’m sorry it took so long to answer and i’m afraid i have no firm solution to propose to you.

      It sounds like your Install is messed up, what you can do is export you blog and reimport in a fresh install to discard that.

      1) Create a new install in a folder in your hosting.
      2) Try your fresh install and see if you are having any of the problems.
      3) Add you theme (and try to see)
      4) Export the content from the problem blog
      5) Import it in your fresh install
      6) Try try and try and see to make sure the problem is not there.
      7) add your plugins one by one… while trying…

      I know it is pretty standard troubleshooting procedure but your problem seems to be larger than the one addressed on this post…

  13. Viernes, 26 de abril de 2013 a las 17:29 | #18

    Hey Nathan THANK YOU for this great post but None of the above solution worked for me or I must be doing something wrong.Can you check my website : techdroidtheory.com . I am getting this error while uploading any media.When I refresh the page I can see the image has been uploaded but for the first time it gives error while uploading.

    • Nathan
      Jueves, 6 de junio de 2013 a las 05:28 | #19

      That is the exact symptom this post addresses, please post a comment here with a user and pwd to your blog (I will not make it public and a normal user will suffice) so i can take a look

  14. Miércoles, 27 de marzo de 2013 a las 09:22 | #20

    @Joel

    Never mind. I found the solution in the theme’s support forum. http://pastebin.com/gY3mTPJ7

  15. Miércoles, 27 de marzo de 2013 a las 07:39 | #21

    Nathan, I have the same theme (I beleive) as Rose. It’s called Minimatica, and the problem is definitely in the functions.php. Renaming that file makes the image upload work fine. I went through and removed all the html type comments and there was a missing apostrophe/quote mark on line 103 but the problem still persists. Any help would be SUPER appreciated. The site is http://www.emilywatsonphoto.com

    Rose, if you could share how you fixed your functions.php that would be great. Thanks!

  16. Miércoles, 27 de marzo de 2013 a las 03:30 | #22

    Hey Nathan,

    Thanks for the great tutorial. I’m still not having any luck though. My uploader was working fine the day before, and I believe I found the problem to be the Quote Rotator plugin. I used the “inspect element” route and found only one problem, linked to that. Once I deleted the plugin, the error disappeared, but I haven’t gotten my uploading ability back. Any ideas? Thanks for any help you can give me!

  17. Tomtidfs
    Martes, 26 de marzo de 2013 a las 11:24 | #23

    Thank you! First helpful post on this. Was a depreciated function in my functions.php.

  18. MindCrack
    Domingo, 17 de marzo de 2013 a las 08:10 | #24

    It’s really good job. So many things i tried to solve it but nothing happen. it was great tutorial or idea to resolve it step by step..
    Thank buddy

    • Nathan
      Lunes, 18 de marzo de 2013 a las 06:02 | #25

      Glad it helped!

  19. Lunes, 25 de febrero de 2013 a las 17:33 | #26

    @Nathan

    Thanks Nathan. I’ll take a look later today.

  20. Nathaniel
    Lunes, 25 de febrero de 2013 a las 04:56 | #27

    You’re amazing. Using your troubleshooting steps, I managed to track the problem down to the theme’s functions.php file, but I can’t see anything overtly wrong with it. If I rename the file, then uploading works… but the site becomes inaccessible. Would you be interested in taking a look at the file? You can grab it at https://dl.dropbox.com/u/10248573/functions.php

    If you can help me figure it out, I’ll make it worth your while. :)

    • Nathan
      Lunes, 25 de febrero de 2013 a las 06:09 | #28

      Hi,
      Well your functions.php has some javascript on it, you didnt mention you site url so i cannot take a look but you can try the following:

      On line 248 starts a function to call external javascript (minimatica_register_scripts) to line 266 (try removing that one and see if it works to try and isolate more the problem)
      There is Java script embeeded on the function on lines: 297 to 333 (try removing them also)

      More JS down there:

      335 to 361

      596 to 622

      671 to 677

      Let me know how it went

  21. Rose
    Jueves, 7 de febrero de 2013 a las 15:57 | #29

    @Nathan Thanks a lot for your immediate reply, unfortunately i’m working on my local system, I ll try to send you a link, at the earliest.

    • Nathan
      Miércoles, 20 de febrero de 2013 a las 10:48 | #30

      No problem, hope you manage to find a solution

  22. Thanks a million
    Miércoles, 6 de febrero de 2013 a las 20:03 | #31

    Thanks for this post, I was having UI.interactions problems on my child theme, I had added a image rotator in the header.php and that was breaking my word press…

    Is there any way to call JavaScript from WP so I can put my rotator back ?

    In any case thanks, at least we can post normally now and add images to the posts.

    • Nathan
      Miércoles, 20 de febrero de 2013 a las 10:49 | #32

      Glad it helps

  23. You are an idiot
    Miércoles, 6 de febrero de 2013 a las 19:59 | #33

    It has been said a million times in the WordPress support forums, it is badly implemented plugins that break things up.

    Rename the plugins folders before you star to cry IT DON’T WORK THIS UPDATE IS CRAP.

    I hated to have to come here to see you don’t offer any solution, just general suggestions.
    Next time post in WP directly.

    • Nathan
      Miércoles, 20 de febrero de 2013 a las 10:49 | #34

      Sorry you feel that way, some people have found solutions here.

  24. Lester D
    Miércoles, 6 de febrero de 2013 a las 19:51 | #35

    Hi i followed your advice and found nothing. However I went to the backend with the developers tools still open and caught a jquery error about some UI thing.

    The only thing I had enabled was the front page slide show plugin so I moved the folder of this plugin out of the plugins folder and the uploaded started to work.

    Thank you i will never had found it without your advice.

    I owe you a beer

    • Nathan
      Miércoles, 20 de febrero de 2013 a las 10:49 | #36

      Glad you sorted it out

  25. Rose
    Lunes, 4 de febrero de 2013 a las 21:03 | #37

    The uploader doesnot work from the frontend for an user with author role, but it works for an user with administrator. Going weird trying to find a solution for this.

    • Nathan
      Lunes, 4 de febrero de 2013 a las 22:03 | #38

      Rose please send me the link to the site with the problem to take a look and see if i can help

      In the end most of these problems come from JavaScript.

  26. Phillip
    Domingo, 3 de febrero de 2013 a las 21:19 | #39

    Dude, you rock. I had something weird in my functions.php file.

    Thanks a mil!

    • Nathan
      Domingo, 3 de febrero de 2013 a las 22:23 | #40

      Im glad it helped mate, i struggled for about a week.
      In the end I’m rewriting all the JS in my sites to comply with WP standards.

  1. Sin trackbacks aún.