nailbuster / esp8266ftpserver Goto Github PK
View Code? Open in Web Editor NEWSimple FTP Server for using esp8266/esp32 SPIFFs
License: GNU Lesser General Public License v2.1
Simple FTP Server for using esp8266/esp32 SPIFFs
License: GNU Lesser General Public License v2.1
Hi.
I had troubles with your FTP-Server uploading small files to SPIFFS (ie. 300byte files).
I noticed the troubles where coming from the blocking TCP-Functions that you use. It makes it behave very unstable.
I have rewritten the entire thing and made use Async TCP-Library from me-no-dev. Its way more responsive and works very nicely. I wanted to share the code with you.
Its just this header-file that also includes the implementation. For me it's part of a different project. Maybe you want to convert it to a stand-alone project, if you like.
I suggest to add your library in the Arduino Library Manager List
The procedure:
https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ
ls
or dir
command invoked by console ftp client returns 550 Can't open directory
error.
Looks like the if (!SPIFFS.exists(cwdName))...
code in LIST implementation should be commented as already done for MSLD.
Could you please add a public method in the class to check if a client is connected to the server and prevent that other part of the code try to access to the files in SPIFFS while they are used by the FTP server? Alternatively a method to close FTPServer and make all files available to the rest of the code again.
Hello. I'm a new user of esp8266, and sice few months ago I started to develop a data logger with ESP-12E module.
All worked since I decided to add the FTP feature to my project (where I use library #include "SdFat.h")
Now I added your library <ESP8266FtpServer.h> and when I compile the scketch I obtain this error:
sp8266/FS.h:136:11: error: 'File' is already declared in this scope
using fs::File;
^
I found here me-no-dev/ESPAsyncWebServer#112 , an old discussion on similar issue, but I was now able to implement to your libary and to solve the issue.
Could you help me ?
thanks Alessandro
I'm using this FTP server in my ESP826 project. I have found that it is very unstable to send some files to server. Based on Wireshark logs TCP connection is dropped after STOR operation:
Debug shows on ESP:
"ftpdataserver client...."
Client (FileZilla):
"
Command: STOR esp8266-template.cfg
Response: 425 No data connection
"
I have fixed it with following change in FtpServer::dataConnect() (code attached below):
Not sure if it is best solution, however after this changes files transfers works stable at every time.
Regards,
Bruno
"
boolean FtpServer::dataConnect()
{
unsigned long startTime = millis();
//wait 5 seconds for a data connection
if (!data.connected())
{
while (!dataServer.hasClient() && millis() - startTime < 10000)
{
//delay(100);
yield();
}
if (dataServer.hasClient()) {
//data.stop();
data = dataServer.available();
#ifdef FTP_DEBUG
Serial.println("ftpdataserver client....");
#endif
}
}
return data.connected() || data.available();
}
"
I have unzipped your library along with the one at https://github.com/esp8266/Arduino.
It still wouldn't compile.
Arduino IDE complains about not being able to find queue.h - I found this in tools/sdk/.... and copied it to C:\Program Files (x86)\Arduino\libraries\esp8266FTPServer and I got past this compile error.
So clearly there are other things that you need to do with the Arduino IDE installation to make your library compile without my hack. And you need to details these, step by step.
I am running esp8266FTPServer on an ESP8266. I have used this library for several years without any issues. I recently had to recompile some old code using the Arduino IDE 1.8.8 plus the newer 2.5 board manager. I am not sure if my problems relate to the new IDE and board manager, insufficient memory or some other unrelated issue. Filezilla has gone through several revisions since I used this code last too.
Here's the problem:
Using Filezilla I can download fine. When I try to upload with Filezillza, many files show a size of zero. If I try to delete them and go again, I get the overwrite message even thought they should be deleted and I still get the zero size file. My sketch seems able to do these operations fine, no problems upload, downloading or deleting if done within the sketch. Free memory is around 32000.
Not only can I not isolate the source of the problem, I am not sure how to go about troubleshooting it,
Thoughts anyone?
Hello nailbuster,
Firstly, thank you for the library.
I tried your example, I editted in my ssid and password and keyed in the user name and password from my Filezilla site in the main function of the example. and I couldnt find a place to key in the Host IP address. I ran the code on my ESP8266 Huzzah Feather, and it only shows this:
Connected to MySSID
IP address: 192.168.179.8
SPIFFS opened!
then it just gets stuck there, I am sure its a beginner's inquiry since I am not familiar with FTP servers and all, seeking your assistance
Regards
I successfully used this library in a project, but suddenly nothing seems to work anymore!
If I set the ESP core to 1.6.5 there is no SPIFFS.
If I set either 2.0 or 2.1 I get an error in buf format for ReadByte function in the library.
As it looks, the standard is now more strict in the compiler, so it won't accept conversion from char to unsigned char.
I reinstalled the Arduino IDE (1.6.7 I admit) to no avail.
Now I removed all references to FtpServer from my projects, but as soon as I include the library the sketch compiles but hangs on startup.
Is it possible to give a fast check to this issue?
Shouldn't be a big problem for somebody who knows where to look.
You haven't specified which WifiESP library, and by who, your library is dependent on.
So when I download this it won't compile!
Can you please specify the github repositry that you have used re #include <WifiESP.h>
Hi, thanks for library. It's works good for me, but since Esp8266 community Library 2.7.1, SPPIFS seem to depreciate and we are encouraged to migrate to a LittleFS file system. I have tried to convert all SPPIFS references to LittleFS reference in your library. The compilation runs Ok, and I can connect to my FTP server without problem. But when I try to Upload or download one file, I obtain an error and can't do it. For example, when I want to show root directory, I get "425 No data connection MLSD". Is-there any chance than you upgrade your library to be compatible with LittleFS file system ?
Best Regards
Eric
I can connect to ESP8266 FTP serever in local network.
I have tried connect to ESP8266 from internet, but I did't set well the router port forwarding. The outer PC connect to the ESP, but it didn't download the contents of it. After this wrong connection I can not connect to ftp server from local network. The symptom is similar, the client connect to the server, but the contents are not downloaded. I can see a 'downlad' pop up window (Total commander), but nothing happens.
After that I restart the ESP and I can connect from local network.
esp with working wifi, www server, spiffs, socket, oled via spi.
added ftp, and when transfering file esp crash.
using filezilla, disconnect client when choiced transfer file (i have to connect again, wait for connection).
A strange little issue..
I have some large .js files "212k and 290k" included in to my web interface, i decided that using gz and the browsers deflate option would be a much better alternative.
If i upload the .gz files using the serial IDE interface it all works perfectly but if i upload the same files using FTP for some reason it appears the file becomes corrupt or truncated.
using gzip the files come down in size to 26k so i would not have thought the issue was a size problem.
Hello,
I am using this library with no problems but after some time (about a week ) it stops working and fails to retrieve the directory listing. Http server which is installed alongside and have an access to SPIFFS works without problem so the ESP is working.
Hello,
I'm working with this library and i was wondering if there was some kind of way of breaking from the loop when the quit command is recieved. For example:
While(True){
ftpSrv.handleFTP();
if(Quitcommandrecieved()){//This function does not exist, is there a way to still do this?
break;
}
}
I've been testing the changes for faster upload/download and esp32 support.
I've found almost everything works well with both esp8266 and esp32....
Found one issue that don't know if others can replicate. Upload of files larger than 512K (524,288) bytes will 'stall'. On the esp8266 the file will eventually upload fine, on the esp32 sometimes the file will fail upload but trying again usually gets the file to the esp32.
downloading files >512K works fine and fast.
all testing was done using FileZilla.
esp32 itself isn't 'perfect' yet... I was testing it hard and got to the point where I had to reformat the spiffs to get it working but couldn't replicate it.
thanks to the all those who have contributed/helped.
Hi.. I am trying to login via normal FTP command prompt in windows... Can't get past this point.. Any ideas?
ftp> open 10.0.0.247
Connected to 10.0.0.247.
220--- Welcome to FTP for ESP8266/ESP32 ---
220--- By David Paiva ---
220 -- Version FTP-2017-10-18 --
500 Syntax error
530 user not found
User (10.0.0.247:(none)):
in FTPFilesystem.h
#ifdef ESP_IDF_VERSION && ESP_IDF_VERSION_VAL
line 57 needs to be replaced by
#if defined ESP_IDF_VERSION && defined ESP_IDF_VERSION_VAL
otherwise it wont compile
I made some changes to increase transfer speeds to the range of 100 - 300 Kbytes/s. Also reduces blocking so ftp can co-exist with other services. Let me know if you want a PR.
Hi David. Thanks for esp8266FTPServer!
My ESP is set up in AP mode so doesn't have WiFi.localIP set. To connect from my android phone I added:
else if( ! strcmp( command, "PASV" ))
{
if (data.connected()) data.stop();
dataIp = WiFi.localIP();
if(0 == dataIp[0]) /// <<< These two lines (There's surely a better test !?)
dataIp = WiFi.softAPIP(); /// <<<
Don't know if it's the right way but it works in this instance. :-)
Thanks again
Doug
Hi,
im trying to integrate your project using a ESP CAM. Connection works, upload works, download works, BUT after refreshing the folder in FileZilla I get an empty folder.
Any hint what to look at?
Hi all, I'm using SD card in MMC mode, and have nice transfer rate to and from SD (3-5 MB/s).
But I need reading SD card by 4096byte block for this.
This lib use 2*1460 byte buffer and it so little for me.
Only 0.5-0.6 MB/s transfer rate.
Hi David,
I just stumbled upon this nice ftp server, works great out of the box.
Is any work done on emulating folders?
All is well with my use of the FTP server for updating and changing files in my ESP8266 SPIFFS with one exception.
'Advanced IP Scanner' crashes the Ftp server causing a reboot. Here's the exception Decode:
0x400dc503: FtpServer::userIdentity() at C:\Users\William\Documents\Arduino\libraries\esp8266FTPServer-master/ESP8266FtpServer.cpp line 1020
0x400de4d9: FtpServer::handleFTP() at C:\Users\William\Documents\Arduino\libraries\esp8266FTPServer-master/ESP8266FtpServer.cpp line 1020
0x400d71d6: loop() at C:\Users\William\Documents\Arduino\OWM_forecast_ESP32_SPIFFSg/OWM_forecast_ESP32_SPIFFSg.ino line 371
0x400e95e5: loopTask(void*) at C:\Users\William\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\cores\esp32/main.cpp line 19
0x40088f75: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 355 (discriminator 1)
Any advice?
Hi, I would like to use the ftp server, but I am using ESPAsyncWebServer. The ftp tries to connect but then stops and does not do anything or issues a random error (username, password or something else).
The ESPAsyncWebServer does not use server.handleClient(); in the loop(). Do have any idea how can be done so that both work together?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.