Example of how to upload a file using shell?

Is using “do shell script” and cURL really a better way to upload a file than URL Access Scripting? If so, can somebody give me a simple example of how to upload a small text file with this method?

Is one method better than the other? Not necessarily.

One requires less script writing. One is easier to read. Both will do the same thing:

Curl:


do shell script "curl -T /path/to/file  -u username:password [url=ftp://ftp.server.dom/path/to/upload/]ftp://ftp.server.dom/path/to/upload/"[/url]

URL Access Scripting:

tell application "URL Access Scripting"
   upload file "path:to:file" to "ftp://username:password@ftp.server.dom/path/to/upload/" without binhexing
end tell

The ‘without binhexing’ is needed with URL Access Scripting because the default is to binhex files when uploading.

If I’m uploading a plain text file, do I need to use --use-ascii or is it OK to exclude it?

I think “–use-ascii” is only to “get” files, not to upload them.
btw, here is another example, which can also upload folders:
http://macscripter.net/exchange/comments.php?id=338_0_1_0_C

One reason I stopped using URL Access scripting is that it was broken for a long time in OS X (it claimed to be able to POST forms, but couldn’t). I got tired of it, and cURL seemed much faster. cURL can also do a LOT more than URLAS, like save/respond to cookie, follow redirects, and much more.