Malformed stream when uploading file to Box
var axios = require('axios'); var data = '\n--------------------------foo_bar_baz\ncontent-disposition: form-data; name="attributes"\n\n{"name":"ENC-mob.key.lock", "parent":{"id":"115921805292"}}\n--------------------------foo_bar_baz\ncontent-disposition: form-data; name="file"; filename="ENC-mob.key.lock"\ncontent-type: text/plain\n\n1\n\n--------------------------foo_bar_baz--'; var config = { method: 'post', url: 'https://upload.box.com/api/2.0/files/content', headers: { 'Content-Type': 'multipart/form-data; boundary=------------------------foo_bar_baz', 'Authorization': 'Bearer ' + this.credentials.access_token, }, data : data }; console.log("Data: " + _params); try { let response: any = await axios(config) console.log(JSON.stringify(response)); return response; } catch(error) { console.log(error + "\nError Message: " + error.message + "\nError response: " + JSON.stringify(error.response)); return error; };
0
I am trying to upload a file to Box drive using its upload API, but I get Malformed Stream error response. I cannot figure out why?
サインインしてコメントを残してください。
コメント
2件のコメント