New library FTPSendFile

Hi everyone,

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.

It uses the excellent SDFat library, the particleFTPClient and my compressFile library.

The library lives at: github

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.

2 Likes

Sweet!

How large of a file have you successfully tested with the FTP uploading?

Good question, The largest file I send over was about 1 megabyte (already compressed).

What did that 1-megabyte file uncompress to size wise?

@rickkas7 has a robust FTP library he built for uploading files to FTP server if you ever have an issue with the one your using.

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.

Could you point me to the FTP library? I read about it, but could not find it on his github?

Yea, it's not on Github but it is listed in this forum post:

Let us know if it's helpful or not.

I'm looking for a way to download large files to an SD card reliably. So far none of the libraries can do that successfully consistently.

I saw you gave a “like” to my TFTP library. Did that have issues with large files?

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.

I added code to get files from an FTP server as well now. This is uncompressed for now.

Care to share your code? This could be useful to me for updating images on an SD card storing images for LCD screen.

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

Hi All. Jychuah updated his library and you should now be include my library using the particle library manager. Example is compiling.

1 Like

For future readers of this thread: the version @wvdv2002 is talking about is ParticleFtpClient v0.0.4.

1 Like