FTP

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

xbytor

FTP

Post by xbytor »

I've implemented some code to simplify uploading files to an FTP server. Since the webaccess dll in CS3 only works with Bridge, this script uses Bridge for the actual transfer even though you can call it from PS.

Here is some sample code that I've been using for testing from PS and ESTK:

Code: Select all//
//@show include
//
//@includepath "/c/Program Files/Adobe/xtools;/Developer/xtools"
//
//@include "xlib/FTP.jsx"
//@nclude "xlib/XBridgeTalk.jsx"
//

RemoteFtpConnection.test = function() {
  var conf = new FTPConfig();

  conf.passive      = false;
  conf.username   = "xbytor";
  conf.password   = "password";
  conf.hostname   = "192.168.1.114";
  conf.logFile    = "~/ftp.log";
  conf.logEnabled = true;

  var ftp = RemoteFtpConnection.createFrom(conf);

  ftp.putDirTree(new Folder("/c/cygwin/home/xbytor/images"),
                 "tmp/images");
  $.writeln("Done.");
};

RemoteFtpConnection.test();


The only api I've implemented on the RemoteFtpConnection class is putDirTree which will upload an entire directory tree to the server in the designated folder. That was the particular problem I had to solve; I'm adding ftp upload to my web photo gallery extension package.

I'll add other APIs as I need them or as people request.

-X
xbytor

FTP

Post by xbytor »

That code use Bridge to do the FTP and, as far as I can tell, Bridge still bundles the necessary library (webaccesslib) so it should work.

You should probably get the most current version from sourceforge.net (xtools/xlib/FTP.jsx) and you may need to tweak it to work with CS4 as it is hardwired to work on in CS3 at the moment.

Let me know how it goes.

-X