Answers for "node js post multipart/form-data"

-1

node js post multipart/form-data

var jsonUpload = {  };
var formData = {
    'file': fs.createReadStream(fileName),
    'jsonUpload': JSON.stringify(jsonUpload)
};
var uploadOptions = {
    "url": "https://upload/url",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer " + accessToken
    },
    "formData": formData
}
var req = request(uploadOptions, function(err, resp, body) {
    if (err) {
        console.log('Error ', err);
    } else {
        console.log('upload successful', body)
    }
});
Posted by: Guest on October-28-2020

Code answers related to "node js post multipart/form-data"

Code answers related to "Javascript"

Browse Popular Code Answers by Language