var header = boundary +Question
uploading file from js fetch api to box and keep getting 415 error. Can anyone please let me know what mistake I am making here? Thanks
var header = boundary + "\r\nContent-Disposition: form-data; name=\"file\"; filename=\"" + this.fileData[0].Title + " \"" +
"\nContent-Type: application/octet-stream" ;
var footer = boundary;
const body = '{"name":' + this.fileData[0].VersionData + ', "parent":{"id": '+ 12345 + '}}';
console.log('body--',body);
fetch(uploadEndPointURL,{
method: 'POST',
mode: 'cors',
cache: 'no-cache',
Body: body,
headers: {
'Accept': '*/*',
'Authorization': "Bearer "+this.accessToken,
'Content-Type': 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': uploadEndPointURL,
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Credentials': true
}
}).then(function(response){
console.log('response--',response);
console.log(response.body);
}).catch(function(error) {
console.log('error--',error.response.data.message);
})
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
