In my Project I send Multipart form-data from angular side to nodejs. the format of data i received is
{ name: 'customer.test.14',
email: '[email protected]',
website: 'www.google.com',
contact_name: 'Vijay',
contact_number: '+123456789022',
profile: 'Testing',
provider_category: 'exchange',
services_offered: 'Testing',
description: 'Test',
image:
[ { size: 1474,
type: 'image/png',
path: 'bc31dac580a7c2086f306fe0b9b5182d/',
basename: 'icon_dd_chart_grey.png' } ] }
I want to send data this to another api in nodejs. but api does not upload image.
here is my code
var request = require('request');
var api_url = global.common.base_url + 'vcard/1.0.0/visit_card/' + req.param('uuid') +'/';
console.log(req.body);
request({
url: api_url,
method: 'PUT',
headers: {
'Content-Type': 'multipart/form-data;',
'Authorization': 'Bearer '+req.cookies.apitoken
},
json: req.body,
}, function(error, response, body) {
if(response.statusCode == 200 && !error){
res.end(JSON.stringify(body));
}else{
res.send(response.statusCode, { error: body });
}
});