I am new to javascript and am trying to write a script which can copy a photoshop file from the local drive to a FTP server. The file is opened in photoshop and the script is run inside it.
I followed documentation(pdf) on page 165.
var file_path = app.activeDocument.fullName
var file = new file ("/d/project/test_file.psd");
var ftp = new FtpConnection("ftp://192.168.1.150/DATA/") ;
ftp.login("username", "password");
ftp.cd("project")
ftp.put(file,"test_file.psd") ;
ftp.close() ;
file.close() ;
I get an error as the following:
Error 22: file does not have a constructor.
Line: 2
-> var file = new file("/d/project/test_file.psd");
I am not able to understand the issue properly.
To make JS FTP-friendly, one would need to request FTP standard to allow CORS "headers" or so. The mozilla docs have changed to specifically remove the part about "other protocols". Now just says Despite its name, XMLHttpRequest can be used to retrieve any type of data, not just XML.
Setting up automatic FTP scheduling is as easy as right-clicking on the folder or directory you want to schedule, and clicking Schedule. In the Task Scheduler section you'll be able to name the task, and set a date and time for the transfer to occur.
Assuming you are already loading the Web Access library (webaccesslib) as stated in previous pages of your documentation, please ensure you're respecting capitalization when calling class instances.
var file = new File("/d/project/test_file.psd");
Must have File
with capital F. The error is saying there's no implementation of class file
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With