0

I'm writing an AIR application that connects to my Subversion repo, gets the diff, and then downloads them to deploy to my website. I'm doing this via a NativeProcess which runs '/usr/bin/svn' and execute the necessary svn commands.

That's all working well up to uploading them to my website. I can't quite figure out how to upload the files to my website via an FTP terminal command using '/usr/bin/ftp'

Does anyone know how I can accomplish uploading a file to an FTP with AIR?

EDIT: SOLVED!

Instead of using FTP I switched to CURL using the following command:

curl --ftp-create-dirs -u uname:pass -T /Users/me/Documents/Subsync/tmp_109065090/sub/index.html ftp://ftp.mysite.net:21//web/content/sub/index.html

Couple things to note

  1. Be sure to add --ftp-create-dirs
  2. After the port use a double slash so that it bypasses the FTP's redirect (used when your ftp account is a sub-account or in a shared hosting environment).
  3. For ssl add --ftp-ssl to the curl command
Cam Tullos
  • 2,537
  • 1
  • 21
  • 18
  • What have you tried? You know how to run stuff through NativeProcess, so what's the difference between running `svn` and running `ftp`? – Creynders Jul 25 '13 at 12:08
  • @Creynders I think the difference is that `ftp` usually requires an "interactive" session. In comparison the `svn` commands all do something and the process exits. @Cam Tullos, you might want to research how to [script an FTP session](http://stackoverflow.com/a/936227/398606). I know it's possible, the answer I linked to is one place to start... Then your AIR app can run `ftp` and make it run your script. – Sunil D. Jul 25 '13 at 17:09
  • Creynder I've tried NativeProcess commands to the FTP bin but for what ever reason it doesn't accept the commands. It's like @Sunil D says. I'll look into sockets I suppose. They just always seem so unreliable in actionscript. Thanks – Cam Tullos Jul 25 '13 at 20:03
  • Well I'm almost there.. I decided to use curl -T to FTP the files. I'm able to upload files to the root directory of my ftp but can't seem to create sub directories on the fly. I get the following curl error: curl: (9) Server denied you to change to the given directory – Cam Tullos Jul 25 '13 at 23:42
  • I'm using this command: curl -u uname:pass -T /Users/me/Documents/Subsync/tmp_109065090/sub/index.html ftp://ftp.illumifi.net:21//web/content/sub/index.html – Cam Tullos Jul 25 '13 at 23:57
  • I GOT IT!!!!!!!!!!!! adding --ftp-create-dirs to my curl command did the trick – Cam Tullos Jul 26 '13 at 00:06

0 Answers0