1

I am trying to upload csv file from angular POST to Web API post but Eeb api return below error

"XMLHttpRequest cannot load http://localhost:89/WebService/Upload. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://Application:90' is therefore not allowed access. The response had HTTP status code 404."

Note : Normal post with JSON data working after doing cross enable in web api, only issue with file upload .

ArK
  • 18,824
  • 63
  • 101
  • 135

1 Answers1

0

This is because the server is not returning the 'Access-Control-Allow-Origin' header with your 'localhost' origin.

So this problem can be solved as follows:

  • Add support for CORS at server side to allow your origin (localhost) to make requests.
  • or by disabling the CORS in your browser, similar kind of problem is already discussed here also Disable same origin policy in Chrome
Community
  • 1
  • 1
Ahsan
  • 9
  • 1
  • 1
  • 9