FTP Upload. Need Help

Hi. Just want to create 1 txt file on a remote ftp server. Just tried communicating with a telnet connection. I'm able to Login to the server and send the STOR command but cant initialize the strem transfer because i don't know how to make another socket connection between the two ports PASV command sends me. In other words: how to upload to ftp? Any help would be appreciated. Many thanks

Here is a sample passive FTP client sketch: http://arduino.cc/forum/index.php/topic,93502.msg707104.html#msg707104

It will either upload from the FTP server to the SD card, or download from the SD card to the FTP server, depending on "#define FTPWRITE".

Many thanks. It works!!! Only one question. I've inserted the code in a sketch of mine that does many other things. I've noticed that if the ftp server response is slow it stucks somewhere in your code. I think it may depend on the while statements. Is possible to write them in another way in order to avoid the problem?

The code still needs some work. The main reason it will be slow is the way it transfers the file to the FTP server (not from it, that should be ok). Look for the "needs improvement" remark. It should buffer an array of characters and send them in one packet.

Feel free to modify it to meet your needs.

edit: Also try removing the Serial.print() of the file contents during the transfer. On a larger file, that could eat up some time too. That was put there for debugging only.