Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
How to fix blank PDF file sent using https.put in a SuiteScript?
Hi,
I am new to suitescript and want to implement https.put() to upload a binary file (pdf, docx, image) based on either the file_id from file cabinet or actual file selected by user from his/her computer to upload. In any case, currently when I upload a pdf, a blank pdf is created on the target server. Could you please guide me the steps to follow? Here is the code I wrote
var fileObj = file.load({
id: bm_fileid
});
var putreq_headers = {};
putreq_headers['Content-Type'] = 'application/pdf';
var filecontent = fileObj.getContents();
var filebase64 = encode.convert({
string: filecontent,
inputEncoding: encode.Encoding.BASE_64,