I have created a new libray which can be used to send files from a SD card to a FTP server.The files will first be compressed before being send. Missing directories on the server will automatically be created.
There are a few security challenges with a passive FTP server, but it works quite well for now. Please read the documentation before using the library.
I use this library on the electron to send files from the SD card to a server. Compressing the files saves about 50% of data.
Edit:
I did not make the library public yet, as I askes jychuan to update his library to the new library system first, as this will also add a commit I need, as it is not possible now in the particleftpclient to choose a port on the server. Feel free to checkout/use the github version.
I just now tried to decompress a heatshrinked file, compressed size 245kb, it decompresses to a size of 707kb. This is with a log file with some quite often repeating strings, so results may vary.
Actually, this is the first I have seen your FTP firmware so I have not tried it yet.
I tested another program for FTP download to SDcard and the biggest file I could download was 100mb or so before it would just freeze up. I couldn’t find an alternative piece of code for downloading from FTP to try out.I
Your compress and upload code looks nice and tidy, I’m certainly going to try it out.
Do you ever plan to add a function for downloading from an FTP and storing on the SD card, kinda the opposite of what you’re doing with this library?
There are no plans for implementing the downloading of files for now. I don’t know if this library is more stable for large downloads than others. There is no error recovery for now, which I did not need, as files of about 1mb rarely go wrong. I guess it is different with 100mb files. Feel free to use this code as a basis for implementing a downloading solution.
I don’t know if it is possible with a FTP server to continue a download at a beforehand failed point. Some kind of download manager would be cool to have.
I would say the main strength of this library is the easiness of setup in a few lines of code, not stability for large files.
Yea, I noticed small files with the other FTP program are no problem either, it’s the larger files that freeze up the Photon.
@Rickkas Thinks downloading large files to an SD card would best be done via HTTP transfer along with a resume where you left off feature if the download was interrupted. That currently does not exist for the Photon but maybe someday somebody will create code to accomplish this. I have no idea how to code this.
The code is in the Github and in the Particle library manager. There is still one problem with the ParticleFTP dependency, but the maintainer of that library is working on it