Here is one approach:
$ ftp -n <<EOF
open ftp.example.com
user user secret
put my-local-file.txt
EOF
Alternatively, create (or edit) the ~/.netrc file in the home dir of the user that will run the ftp command, give it appropriate perms (chmod 0600 ~/.netrc), and add the following:
# ~/.netrc
machine ftp.example.com
login user
password secret
Then omit the login information, as in:
$ echo put my-local-file.txt | ftp ftp.example.com
Also, here's how you might do the same thing using curl:
$ curl -T my-local-file.txt ftp://ftp.example.com --user user:secret
ftptool in Ubuntu, but it looks like it's choking on theftp://. try taking that out maybe? – Nate Koppenhaver Aug 15 '11 at 4:15