I have a problem when trying to post a PDF-file in multipart/form-data.
Below code in a function node:
msg.headers = {};
msg.headers['Content-Type'] = "multipart/form-data; boundary=------------------------d74496d66958873e";
msg.headers['Authorization'] = 'Bearer '+msg.token;
msg.payload = '--------------------------d74496d66958873e'+
'\r\n'+
'Content-Disposition: form-data; name="Title"'+
'\r\n'+
'\r\n'+
fileName +
'\r\n'+
'--------------------------d74496d66958873e'+
'\r\n'+
'Content-Disposition: form-data; name="files"; filename="file.pdf"'
+'\r\n'+
'Content-Type: application/octet-stream'+
'\r\n'+
'\r\n'+
msg.payload+
'\r\n'+
'--------------------------d74496d66958873e--'+
'\r\n';
msg.url = "https://fqdn/v0.1/companies/1782/candidates/1234/attachments";
I'm "injecting" this in to a http request node...
This works fine with txt-files, but when trying with PDF, the document gets destroyed.
msg.payload comes from a file in node delivering the msg.payload as "a single buffer object"
Any one with thoughts or ideas on this?
BR
Kjell Brandes