-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content-Type not supported #488
Comments
I also tried this:-
And whilst this does send the right Content-Type header I am getting just a 2 byte body which isn't correct. |
Your code should look like this: #88 (comment) |
Also tried:-
This does appear to send binary data but it isnt recognized by the server so something still isnt quite right here. Beginning to think this isn't angular-file-upload. Will continue to investigate. |
The demo page is your best help, you can even edit the javascript and change the url to upload to your server if your server supports cors. |
Thanks Danial. I've been looking at that and retrying my example...I will try running your demo page against my server (if poss). However, in the meantime I have a little more info...if I use XMLHttpRequest directly; i.e.:-
The binary data is sent to the server fine and returns the expected response. Perhaps something might have changed in angular's $http? I am using 1.3.8 |
Well the demo page is working with angular 1.3.6 and selecting the second option for upload, so if you follow the code in the demo page you should be able to figure out what you are doing differently. |
Hi Daniel, I did try and diff the site version and 2.1.1 but there is a big delta and it was pretty much impossible for me to spot anything obvious I am afraid. |
I just deployed the latest code of the demo page again and it still works. There shouldn't be any diff between the js codes. What files are you comparing? |
Nevermind. I had modified your code (based on something mentioned in issue 88) and hadn't reverted that change. My bad. Having reverted that it's working fine. Many thanks. I will close. |
Hi there,
I have same requirements as described in:-
#88
Using version 2.1.1
Code is pretty simple, as follows.
In my html I have:-
In my backend controller, I have:-
When I execute the code the request is sent with Content-Type: application/json which is obviously wrong - should be image/jpeg - and is therefore rejected by the server which is expecting image/jpeg.
There is clearly something obvious that I am missing here but I can't spot what it is. I did try debugging through the code but always end up in the angular code that strips content-type header before sending each request.
Any help, gratefully appreciated.
The text was updated successfully, but these errors were encountered: