Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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,
0