FTP连接和使用Javascript复制文件 [英] FTP connection and copying file using Javascript

查看:62
本文介绍了FTP连接和使用Javascript复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是javascript的新手,我正在尝试编写一个脚本,可以将photoshop文件从本地驱动器复制到FTP服务器。该文件在photoshop中打开,脚本在其中运行。

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.

我跟着 documentation(pdf)(第165页)。

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() ;

我收到如下错误:

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.

推荐答案

假设您已经按照文档前几页中的说明加载了Web Access库(webaccesslib),请确保在调用类实例时尊重大小写。

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");

必须有文件,资本为F.错误是说没有实现类文件

Must have File with capital F. The error is saying there's no implementation of class file.

这篇关于FTP连接和使用Javascript复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆