1var jsonUpload = { };
2var formData = {
3 'file': fs.createReadStream(fileName),
4 'jsonUpload': JSON.stringify(jsonUpload)
5};
6var uploadOptions = {
7 "url": "https://upload/url",
8 "method": "POST",
9 "headers": {
10 "Authorization": "Bearer " + accessToken
11 },
12 "formData": formData
13}
14var req = request(uploadOptions, function(err, resp, body) {
15 if (err) {
16 console.log('Error ', err);
17 } else {
18 console.log('upload successful', body)
19 }
20});
21