# Example of how to upload a file using AppleScript & UNIX Shell?



## freaky (Aug 7, 2004)

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?


----------



## scruffy (Aug 7, 2004)

simple example for ftp:

curl --upload-file foo.txt ftp://some.server/some/folder/

You can also add options like
--user usernameassword

As always, rtfm.


----------



## freaky (Aug 7, 2004)

So instead of doing this:


```
tell application "URL Access Scripting"
    upload file.txt to "ftp://login:password@server.com replacing yes without binhexing
end tell
```

Would this be correct or do I need to run it inside of a tell statement?


```
curl --upload-file file.txt --user login:password ftp://server.com
```

Can you send me the link to the manual? All I have is is an OReilly book and I can't find a manual for AppleScript on apple.com/applescript or on Google. I guess they have one just like the PHP manual??

Thanks for your help.


----------



## scruffy (Aug 7, 2004)

Sorry, I just meant the curl manpage - lots and lots of useful options (how to use proxies, upload http forms, etc. etc.)

The only manual for applescript I have is the one that came with the developer tools cd - it's installed at /developer/documentation/applescript.

I don't know about how to wrap that into applescript.  I'd just write a shell script and run it in the terminal, cuz that's what I know how to do...


----------



## anarchie (Aug 7, 2004)

do shell script "curl --upload-file file.txt --user loginassword ftp://server.com"


----------

