RE: Uploading/POSTing a file to the File Cabinet from an outside web page
Hi all, I have an external application that is posting to a Suitelet and I’m attempting to create a new file in the file cabinet. I’m currently building a FormData object and delivering that with the POST. The FormData includes a file field and an input field.
My POST is hitting my Suitelet successfully and I’m able to extract and log the message field with the following:
context.request.parameters["message"]
But I can’t seem to figure out how to access the file from FormData. The following code:
context.request.parameters["vanillaFile"]
Gives me [object FileList] but it doesn’t seem like I’m able to work with the object as expected – not even positive that it’s truly an object. Might just be a string.
I know I can create a Suitelet UI with a file input field and consume that pretty easily but I’m looking to use my external HTML page.
Does anyone know how to POST a file to the NetSuite backend and create a file (create.File) with it?
Thanks in advance!
Assuming you are doing a simple form post using multipart form data, your file will be in the request: ServerRequest.files. You are supposed to set the folder and save it somewhere in the file cabinet