Closed mattdesl closed 8 years ago
I'm having the same issue. Is there any solve for this? I even tried to set the responseType to "text/html" or "text/plain" and no luck. My service is returning JSON and IE9 wants to download the response.
Make sure that you're returning JSON from the server with Content-Type of text/html
. That's almost certainly the issue.
Check the response headers in the console to find out the Content-Type
and let me know what you see.
OK that does work now (it doesn't ask to download it anymore), however, for IE9 the onError handler gets called, not the onComplete. I set the responseType to "text/html" when I'm setting it up. Do I have to execute some other functions just for IE9?
Sorry for the delay.
Do you mind posting your code for me to take a look at?
I get exactly this same issue. I have a feeling it's something to do with Flask though.
Got the same problem too, if I set the response type to application/json
IE 8 and 9 ask to download a .json file, while if I set the response type to text/html
, on all the browsers, it triggers both the onComplete
and onError
callback :(
Here's the code:
uploader = new ss.SimpleUpload({
button: 'upload-btn',
url: '/upload_img',
name: 'img',
allowedExtensions: ['jpg', 'jpeg', 'png'],
maxSize: 1024,
onComplete: function(filename, response) {
alert(response.message);
},
onError: function(filename, errorType, status, statusText, response) {
alert('Unable to complete the upload process!');
}
});
The result is that I see before the first alert (with undefined content) and then the one inside onError
callback.
Moreover if I set `responseType: 'json'' in the uploader config, the response is correctly parsed and it yells the right content on the 'onComplete' callback, but it triggers the 'onError' callback anyway :(
In debug mode I got this messages:
[Uploader] Commencing upload using multipart form
[Uploader] Server response: {"message":"Image uploaded!"}
[Uploader] Upload failed: -1 reponse is not defined
Any tips?
When I try this on IE9 it is treating the result as a download. It pops up as "Do you want to open or save uploadd9021494912.json" instead of continuing the callbacks through JS.
Settings: