```hi every one, i have the next code: function...
# general
a
Copy code
hi every one, i have the next code:    function saveFile(fileField) {
				
        var fileObj = file.create({
            name: fileField.name,
            fileType: fileField.fileType,
            contents: fileField.getContents(),
            folder: 4165 
        });
				
        var fileId = fileObj.save();		
        return fileId;
    }
[19:20] and i need use it to upload a public_key.pem file but it is showing this error: Error: {"type":"error.SuiteScriptError","name":"SSS_INVALID_TYPE_ARG","message":"You have entered an invalid type argument: MISCBINARY","id":"","stack":["Error\n at saveFile (/SuiteScripts/0004 - Card/SD_SL_UploadPemFile.js8728)\n at Object.principalFunction (/SuiteScripts/0004 - Card /SD_SL_UploadPemFile.js3634)"],"cause":{"type":"internal error","code":"SSS_INVALID_TYPE_ARG","details":"You have entered an invalid type argument: MISCBINARY","userEvent":null,"stackTrace":["Error\n at saveFile (/SuiteScripts/0004 - Card /SD_SL_UploadPemFile.js8728)\n at Object.principalFunction (/SuiteScripts/0004 - Card /SD_SL_UploadPemFile.js3634)"],"notifyOff":false},"notifyOff":false,"userFacing":true} [19:20] but when i save a .txt file it works fine, do you know what is the error? thanks!!
j
what happens if you change the filetype to PLAINTEXT?
you might need to inject a conditional to say if it's binary, just set it as plaintext
b
you haven't really shared enough code, but the guess is that fileField is actually a file.File
in which case you just want to set File.folder and then save
you cannot create a
MISCBINARY
type file yourself, so use the one you have