Discussions
SuiteWorld is the largest annual gathering of the NetSuite community! It will be held in Las Vegas on October 6-9, 2025. Our customers and partners look forward to SuiteWorld every year as a place to hear the latest from NetSuite, get hands-on learning, and connect with each other. Register now!
Join our Ask An Expert Live session featuring Angela Bayliss , Senior Principal Consultant at Jade Global, on June 26, 2025, 2–3 PM ET. With 21 years of experience, Angela will answer all your questions. Learn from one of the best! RSVP now.
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,