CORS issue in file uploading
Hello,
I'm sending file upload request from http://localhost:8080 and getting error
[Error] XMLHttpRequest cannot load https://upload.box.com/api/2.0/files/content. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
Even I had already added http://localhost:8080 on developer console, below is the screenshot.
Ionic 3 request code is following please have a look:
let headers = new Headers(); headers.append('Authorization', 'Bearer ' + localStorage.getItem('boxAccessToken')); headers.append('Content-Type', 'multipart/form-data'); let formData = new FormData(); formData.append('file', 'file://' + path); formData.append('attributes',`{"name":"${newName}","parent":{"id":"${folderId}"}}`) let headersObject = { 'headers': headers } return this._http.post(url, formData, headersObject).map(response => response.json());
Please help me if you have any idea.
Please sign in to leave a comment.
Comments
0 comments