Posting PDF-files multipart/form-data

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'+
'Content-Disposition: form-data; name="Title"'+ 
fileName +
'Content-Disposition: form-data; name="files"; filename="file.pdf"' 
'Content-Type: application/octet-stream'+

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?

Kjell Brandes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.