Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By arbj
#60259 Hi,

I am trying to upload an image file in a micro-sd card to a FTP server online. I have connected the ESP-8266 12 E to the micro-sd card and I am able to access the files in the card, read and create files on it.

I am able to use the ESP as a FTP server, but my real goal is to upload a file to a FTP server online.

I wrote some code to login and setup a passive connection, but I was hoping if there are any ready to use FTP client libraries, rather than re-invent the wheel.

Are there any FTP client libraries for the ESP-12E ???

thanks
a
Last edited by arbj on Thu Jan 05, 2017 11:08 am, edited 1 time in total.
User avatar
By mrburnette
#60377 There appears to be more than one:
https://www.google.com/search?q=FTP+site:esp8266.com

You may also want to search github with a composite search (esp8266 + FTP) to determine if the software exists out in the ether but never made it to this forum.
Code: Select allhttps://github.com/search?utf8=%E2%9C%93&q=ESP8266+FTP



Ray
User avatar
By arbj
#60445
There appears to be more than one:
https://www.google.com/search?q=FTP+site:esp8266.com

You may also want to search github with a composite search (esp8266 + FTP) to determine if the software exists out in the ether but never made it to this forum. - See more at: viewtopic.php?f=32&t=13132&p=60445#p60445


Thanks for the suggestion I will do that...

You have here some work from rudy (client side , not server, despite of the url's end !!)
http://www.rudiswiki.de/wiki9/WiFiFTPServer


thanks for the update, I saw that one yesterday. I am now trying to code my own FTP client, I am using WifiClient library for this, there are two clients, one for the control and another for data.

Using the control client I am able to login to the FTP server, and send send the PASV command for a passive communication, however for some reason the data connection for FTP is not being setup...

I have re-checked the sequence using filezeilla and wireshark, and I have followed exactly the same sequence in the ESP. However for some reason the data connection is not being opened from the ESP side.

Are there any 'gotchas' for using the WifiClient library , for example I use this code for opening a connection.

Code: Select allzetahost=<IP address of FTP server>
IPAddress zetahost;
WifiClient ctrlFTP,dataFTP;

ctrlFTP.connect(zetahost,21);
if (ctrlFTP.connected()){
 Serial.println("FTP port connected");
}

//the data port is opened when the PASV parameters are received.nPasvPort contains the Pasv port value sent //by the FTP server

dataFTP.connect(Wifi.localIP(),nPasvPort);
if (dataFTP.connected()){
 Serial.println("FTP data port connected");
}


For some reason the data port never shows as connected. Any ideas why ??

I could post the entire code if required,

thanks
a

Update:

I enabled Debug:Core and Debug:Serial in the IDE and I got the following messages.

Code: Select allsta config unchangedscandone
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt

connected with grizzly, channel 6
dhcp client start...
ip:192.168.43.160,mask:255.255.255.0,gw:192.168.43.1
WiFi connected
192.168.43.160
:ref 1
:rn 43
220 ::ffff:185.176.43.62 FTP server ready:wr
:sent 12
:ww
:wr
:sent 2
:ww
:c0 1, 43
:rn 35

331 Password required for XXXXXXX:wr
:sent 17
:ww
:wr
:sent 2
:ww
:c0 1, 35
:rn 296

230 Welcome to your web hosting account!Please upload your web site inside the directory of the respective hostname.(If you wish to upload outside the hostname directories or delete them please make sure Directory Protection is set to OFF from your hosting control panel - File Manager section)logged in
:wr
:sent 4
:ww
:wr
:sent 2
:ww
:wr
:sent 12
:ww
:wr
:sent 2
:ww
:wr
:sent 3
:ww
:wr
:sent 2
:ww
:wr
:rch 296, 19
:sent 6
:ww
:wr
:sent 2
:ww
:wr
:rch 315, 20
:sent 4
:ww
:wr
:sent 2
:ww
:c 1, 296, 335

215 UNIX Type: L8:c 1, 19, 39

200 UTF8 set to on:rch 20, 34
:c 1, 20, 54

257 "/" is the current directory:c0 1, 34
:rn 19

200 Type set to I:c0 1, 19
:rn 50

227 Entering Passive Mode (185,176,43,62,192,82)server ip= 185.176.43.62  Port=192,82Port=49234
:err -8  <<Error code returned after dataFtp.connect(WiFi.localIP(),nPasvPort)
0
:wr
:sent 4
:ww
:wr
:sent 2
:ww
:c0 1, 50

:wr
:sent 4
:ww
:wr
:sent 2
:ww
:ur 1
:close
:del
logged out