-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add FTP and local file system API #73
base: master
Are you sure you want to change the base?
Conversation
Hey, In this part of the programm: Serial.println("Create remote file : test"); it creates a directory and not a file. An upload of the file after that is getting failed. Starting Arduino FTP client. Or is there any problem with my FTP? The user has full access and the directory was already created. Best regards |
Hi Bastiri,
Have you test upload/download from an other FTP client (as Filezilla) to your FTP server and with the same user?
You mean, the test2 directory is created by the Arduino FTP client? What FTP server did you use? Is it a public FTP server? If so, can you send me the hostname and the password? I'll look if I can find an online public FTP server with read/write access... Best regards |
Hi Tryhus, thank you for your fast answer. I have test it on two different ftp servers, one by ionos and the other one is a filezilla-server on my local windows system. If i connect to the servers by filezilla-client, i`ll be able to upload/download files and i can create and delete directories with the same user which is already entered in the secrets.h Now i tested your ftp-client on this public ftp-server: https://dlptest.com/ftp-test/ So it must depend on the my ftp-server. What could be different? I could create an account for you this evening. Best regards |
Is that all the steps are successful with https://dlptest.com/ftp-test/ for you?
ok, you can send me hostname, username and password by private mail. Best regards |
Some FTP server doesn't allow files exchange in active mode. Passive mode can solve this problem. Passive mode is enable by default.
As you did I tested with a Filezilla server and I had the same error. If you use filezilla server you will need to do some extra tuning:
I also noticed that deleting directory didn't work with some FTP server. I fixed it by added one specific function to remove directory and an other one to remove file. And lately, I added the possibility to choose the FTP server port (21 by default). See in arduino_secrets.h. Please, let me know if the code works with your FTP server. Best regards |
Great! Now it works on both of my servers without any problems! Thats a very good feature! Best regards and thanks a lot! |
non blocking function can be useful for large file transfer
Hi Tryhus, Code: Serial.println("Upload a file with non blocking function"); Error: bool uploadStart(const String& localFileName, const String& remoteFileName); |
Hi Bastiri, You can not pass myFile as argument of uploadStart function because there is not implicit conversion from type "File" to const String& You must also check if the file has been opened, if an error has happened myFile is empty.
|
Thank you very much! Now i can compile the programm! Send the file to the server from SD card The files I have tested are very small (1KB and 39KB) |
This code means the file can not be open when sending to FTP server. |
Yes I have closed the file. When I close it directly after the reading or before the upload I get an error "File is not open". |
- Direct link mode allow to transfer between Arduino SRAM and FTP server - Simplify some function and example ino file
Hi Bastiri, I think the problem is that the data you are trying to send are is not saved in the local file system. |
Hi Tryhus, I have tried your new programm and now I can upload a file to the FTP server, but the content of the uploaded file includes not readable characters. Its not the same as in the file on the SD card. I have seen that the file has the size of the buffer (default 128). I tried to enlarge the buffer size but I am not sure how to handle this correctly. This is the code: //--- Test direct upload/download --- //String fileName = "myFile.txt"; File myFile; |
Your code send the buffer content bufferWR to the FTP server not the content of your SD file datalog.txt.
You can try with this code :
Notice, if the SD file is very large, the dynamic allocation may fail. |
Thank you very much for your fast answer and your great support. It works fine with files about 20KB. I tried to upload a file with 39KB but it fails. I think its exactly that what you told. The internal buffer seams to be too small for this.
How could that work? if you want to upload files with <1MB Best regards |
I added functions to stream data to/from FTP server. Increasing the packet size should increase the transfer speed.
|
Yeeesss! It works perfectly. I have tried out files with a size up to 1,5MB. Best regards Bastiri |
your are welcome 👍 |
Just tried your routines and something is wrong and is not working...do you know what is ? I copied all the src files from your forked section and used above sendSDFile but getting error. I tried with Total Commander to create or delete the file and working just fine. Sketch:
|
I have added these lines into main script to test other functions and they just work except the SD card. Where the problem is, can you help to debug or let me know where to dig more ? Thanks
When I tried to specify non existing file on SD, it failed on missing SD file so SD card works...
|
@tryhus Just for a reference for anybody else... from
to
|
Hello @tryhus, first of all, thanks for the ftp library, this is very appreciated you have put together FTP processes. I need some help here, please. I am trying to read downloaded file from modem file system to SD card. I have the files already in file system however trying to transfer them to SD card. Is it somehow possible to transfer data either directly from FTP to SD card or from modem file system to SD card ? I am really stuck here :( |
If somebody will look for receiving FTP file from FTP to Arduino SD card (I am using Arduino MKR GSM 1400) use this sketch See input data:
Call Function
|
|
Hi, several years later... ;-) I can connect and disconnect to server FTP, open the direct link mode (seen passed code), (read 1 or several packets of SDcard file, or made a memory file), but write bytes on FTP is perhaps compromised? I don't know, seen that's there is no respond code of modem... I had good codes if i just connect and disconnect to the FTP server. I can also makedir, delete dir on FTP... FileZilla show me results on dir, but nothing on files. I traced and checked enteries in GSMFTP.cpp, Modem.cpp, with a lot of Serial.println(" ")... |
Hi,
I added an API to use FTP (not with SSL/TLS) and an other to manage local file system.
You can run the example project FTP.ino, you will need a FTP server (with write access).
Let me know if you are interested by these features or if you need some information.