admin管理员组文章数量:1290176
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.
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.
Share Improve this question edited Jan 10, 2016 at 9:37 zingy asked Jan 10, 2016 at 8:40 zingyzingy 81110 gold badges19 silver badges36 bronze badges 3- Good thing to see you tried that. So, what's your problem? – Alfabravo Commented Jan 10, 2016 at 9:27
-
1
Instead of
new file(...)
, trynew File(...)
. Javascript is case sensitive. – Tigger Commented Jan 10, 2016 at 9:46 - The link is broken – HoRn Commented Nov 4, 2021 at 11:59
1 Answer
Reset to default 5Assuming 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
.
本文标签: FTP connection and copying file using JavascriptStack Overflow
版权声明:本文标题:FTP connection and copying file using Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741494814a2381787.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论