Discussions
NetSuite Tip - Uploading a file to an FTP server N/sftp
var connection = sftp.createConnection({
username: userName,
passwordGuid: passGUID,
url: URL,
directory: '/',
hostKey: hostKey
});
//if you have a xml content or json content, create them as a file and upload to FTP
//Module: N/file :> file
var FileToUpload = file.create({
fileType: file.Type.PLAINTEXT,
name: XMLfileName,
contents: soData, //here soData refers to a xml body
});
connection.upload({
directory: '/Outbox/To be Processed', //directory of FTP to upload
file: FileToUpload,
filename: XMLfileName,
replaceExisting: true
});