# “The format is not supported” when uploading images with %20 / spaces in URL

I am attempting to upload the following image "from the web" into a post:

When I do this, the dialog states "Failed to upload image; the format is not supported".

I have been able to narrow it down, thanks to Mhmd's comment below, to URLs that contain (at least) spaces (I tested on my own server with a file named "astro%20naut.jpg", after URL encoding, although I cannot share the URL).

If I upload direct to imgur from such a URL, there is no problem. It appears to be some issue on the SE side of things.

• You could try upoading it to imgur directly, maybe that gives a more detailed error message – Mad Scientist Aug 6 '14 at 17:08
• If I save this on my computer and upload it from there, it works fine, while it doesn't when adding it from the web. – ProgramFOX Aug 6 '14 at 17:11
• @MadScientist It uploads just fine direct to imgur. – Jason C Aug 6 '14 at 19:24
• It is not about the extension, it is about the url itself since it contains letters that are not supported. – Mhmd Aug 6 '14 at 19:32
• @Mhmd Good call; I tested and was able to consistently reproduce with URLs with a space in the URL. I've updated the post to reflect this. – Jason C Aug 6 '14 at 19:55
• I guess the URL is being decoded somewhere when using the API (probably on SE side) so when it reach imgur, it's not pointing on the correct place anymore. – ShaWiz Aug 6 '14 at 22:13
• I've tried to replace the %20 by a space, same error. Then I tried to use TinyURL to change the URL, same error again. – A.L Aug 7 '14 at 4:08
• @A.L Replacing with a space is no surprise (I also observed the same thing), but the TinyURL thing is a surprise. I wonder why that could be? Must mean the problem is somehow after any redirects are handled. – Jason C Aug 7 '14 at 4:09
• @Jason C TinyURL is just a redirection to the file, it seems that this doesn't prevent the problem. – A.L Aug 7 '14 at 4:10
• The format is not supported can concern the URL or the image itself, for example if the Microsoft website doesn't return the right MIME type. – A.L Aug 7 '14 at 4:12
• @A.L That's a good point. In this case, I did test with my own publicly visible web server, and a few different images, all JPEG, all with correctly reported MIME type of image/jpeg, with the same results. The error here in this case is dependent entirely on %20 or a space in the URL, not on any other factors. – Jason C Aug 7 '14 at 4:22

I encountered this problem too and made some tests to see what may be causing it. My guess is that it's probably a bug with the function doing the URL validation: If there is even a single character after %20, the URL would be rejected.