nervgh / angular-file-upload

[ALMOST NOT MAINTAINED] Angular File Upload is a module for the AngularJS framework
MIT License
3.43k stars 1.13k forks source link

IE11 Appending Headers to my uploads #428

Open toddheslin opened 9 years ago

toddheslin commented 9 years ago

Hey peeps! I'm absolutely loving this module, and coupled with the Dropbox 2.0 beta API it's super easy to allow uploads into a Dropbox 'App'. All browsers work fine except for IE (surprise, surprise).

Specifically, here is the issue:

When sending the upload to dropbox I set the header as:

"Content-Type" : "application/octet-stream"

However I'm getting a 400 response from dropbox saying:

"Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "application/octet-stream, multipart/form-data; boundary=---------------------------7df31c1b1101d6".  Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack"."

So it appears that in IE the header I set is being appended and set to:

"application/octet-stream, multipart/form-data; boundary=---------------------------7df31c1b1101d6"

I assume it's because dropbox has a strict requirement and doesn't like the other headers that I'm receiving this error. If I can override the headers with only the ones I want, I'm guessing it will work.

If anyone has worked out a hack to this, please let me know.

Thanks so much!

libinkm commented 8 years ago

I am having the same issue as above, in my case, I used angular to set "Content-Type" : "multipart/form-data", and PUT operation to send a FormData, IE11 seems to change the header to: "multipart/form-data, multipart/form-data; boundary=---------------------------7df31c1b1101d6"

The duplicate "multipart/form" confused the server program, which replied a 415 response - Unsupported media type.

any help?

eablokker commented 6 years ago

+1 Same issue here. Anyone found a fix?