A bit confused by <https://docs.oracle.com/en/clou...
# suitescript
b
A bit confused by https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4223861820.html, specifically,
If the file type is binary (for example, PDF), the file content must be base64 encoded.
If I pass the file base64 encoded and load it in a restlet, it is unviewable on netsuite side. Any ideas here?
I download the file and it is just base64 encoded so this doesn't appear accurate?
I am able to load plain text files just fine.
b
what does your code look like
b
Copy code
else if (context.type === 'file') {
      // NOTE: the name has to be unique!
      const fileRecord = file.create({
        name: context.contents.name,
        fileType: context.contents.type,
        contents: context.contents.contents,
        folder: context.contents.folder_record_id,
      });
      recordIds.push(fileRecord.save())
}
context is the incoming json object
b
honestly not enough information in there beyond you using file.create
hardcode those parameters
b
Yeah, working on rebuilding the json body
I was going down another route.
Hmm, now I can't get it to upload anything.
Alright, not exactly sure what I did. This is more rubberduck. It seems very sensitive to the type that you upload. As in
type: "pngimage"
is not the same as
type: file.Type.PNGIMAGE
which in previous experimentation in other places worked.