I have a specific task: I need to download an image from the source URL and upload it to another host via POST request as multipart/form-data. I'm trying to use node.js request library but never succeed. The following code doesn't send anything in the request body.
request.post({
url: uploadUrl,
formData: {
photo: request(imageUri)
}
}, function (err) {
if (err) console.error(err.stack)
});
I have tried posting directly through the form-data library, but it doesn't seem to work neither. How do I solve this without the creation of temp files?
request(imageUri)
which is available from its callback parameter, you can then proceed with the main post. – Unblessed