I have ftp url, username and passwd.
My file is named app.log.
How do I upload this to my ftp server???
I read the manual but I didn't understand much...
I have ftp url, username and passwd.
My file is named app.log.
How do I upload this to my ftp server???
I read the manual but I didn't understand much...
It's pretty simple, actually. The basic structure is
curl <option> <URI>
with the URI being a combination of protocol, user, password, server, port, and path. The option you're looking for is -T. So the command line would be
curl -T /local/path/file ftp://<user>:<pass>@<server>/remote/path
or
curl -u <user> -T /local/path/file ftp://<server>/remote/path
if you want curl to ask for the password.
Thank you for the information. I noticed that the password "lefts" the PC as plain text, and a sniffer (like wireshark) can easily capture it and thief it. So anyone can have my passwd. Is there any option to make the passwd encrypted or something?
This is a limitation of ftp. If the remote host has sshd running on it, you can use sftp or scp instead:
scp /path/to/local-file user@remote-host:/path/to/destination
Or, in addition to Coronas suggestion, some servers support FTPS (FTP + SSL)