Is it possible to bypass the file cabinet when upl...
# suitescript
x
Is it possible to bypass the file cabinet when uploading a document? Let's say I have a Suitelet with an inline HTML field where a user can place a file (using an HTML file upload field, NOT the native Netsuite document field) Is there a way that that there could be code written to send that file off to another place?
c
Yeah you can grab the file in post and do whatever you want with it.
x
There isn't a how-to anywhere for it is there?
b
i personally would have just used the file field from the suitelet
x
I would too, but certain people I work with won't accept that Netsuite has limitations for what they are trying to achieve.
b
if you are adding your own field, make extra sure its actually part of the form element
x
@battk or @creece How do I actually pull the data from the file with this method? I can definitely pull the name of the file from the ServerRequest, but I'm not seeing anything in my ServerRequest.files
b
what does your file element look like
x
var field1 = form.addField({ id: 'custpage_text', type: serverWidget.FieldType.INLINEHTML, label: ' ' }).updateLayoutType({ layoutType: serverWidget.FieldLayoutType.OUTSIDEABOVE }).updateBreakType({ breakType: serverWidget.FieldBreakType.STARTROW }).defaultValue = "<input class='input' id='custpage_filefield' type='file' name='mediafile'>";
b
looks good to me
what does context.request.files look like?
x
It's empty.
b
probably want netsuite's file field to the form and see what it does that yours doesnt
x
You mean the native file field? I actually looked and it treats that field as a text field in actuality.
b
there are basically only really 2 things that are going to matter for your file field (unless netsuite does something weird with scripts)
first is the element that is used to create the file
compare yours to theirs
the second thing that matters is the form element
compare yours to their
x
Turns out I was wrong, kind of. The file uploader field on a suitelet behaves differently from a file uploader field on a normal record.