Hello all, i'm trying to submit a form with a file...
# suitescript
m
Hello all, i'm trying to submit a form with a file into a suitelet, but for some reason i'm not able read the content of the file.
var postFile = _context_.request.files.photo;
var fileObj = _file_.create({
name: postFile.name,
fileType: _file_.Type.PDF,
contents: postFile.content,
description: postFile.description,
encoding: _file_.Encoding.UTF8,
folder: 804327,
isOnline: true
});
_log_.debug('fileObj', fileObj);
fileObj.save();
any ideas? thank you!
s
If it's an actual file, then file.getContents() should work, check out the
N/file
module in help pages
m
it was it, thank you!