SIM 800, FTP upload problems

I'm having trouble trying to FTP data using a SIM card. The end goal is to upload a JPG from my SD card, but for the time being I'm just trying to FTP data into a text file.

Using an Adafruit FONA, SIM 800, on a MEGA 2560. So far, this code will create the file test.txt on the server, but will not put any data into it.

Code: (IP and login replaced with X)

void Adafruit_FONA::use_FTP(void) {

        sendCheckReply(F("AT+FTPCID=1"), F("OK"), 2000);
        sendCheckReply(F("AT+FTPSERV=\"XX.XXX.XXX.XXX\""), F("OK"), 2000);
        sendCheckReply(F("AT+FTPPORT=21"), F("OK"), 2000);
        sendCheckReply(F("AT+FTPUN=\"XXXXXXXXXX@XXXXXXXXXX\""), F("OK"), 2000);
        sendCheckReply(F("AT+FTPPW=\"XXXXXXXXXX\""), F("OK"), 2000);
 
        sendCheckReply(F("AT+FTPPUTNAME=\"test.txt\""), F("OK"), 2000);    
        sendCheckReply(F("AT+FTPPUTPATH=\"/\""), F("OK"), 2000);
  
        sendCheckReply(F("AT+FTPPUT=1"), F("OK"), 2000);
        sendCheckReply(F("AT+FTPPUT=2,100"), F("OK"), 30000);
        sendCheckReply(F("blahbleeblah"), F("FTPPUT:1,1"), 30000);
        sendCheckReply(F("AT+FTPPUT=2,0"), F("+FTPPUT=1,0"), 30000);
        sendCheckReply(F("AT+FTPPUT=2,0"), F("OK"), 30000);

}

Serial output:

---> AT+FTPCID=1
<--- OK
---> AT+FTPSERV="XXXXXXXXXXX"
<--- OK
---> AT+FTPPORT=21
<--- OK
---> AT+FTPUN="XXXXXXXXXX@XXXXXX"
<--- OK
---> AT+FTPPW="XXXXXXXXXX"
<--- OK
---> AT+FTPPUTNAME="test2.txt"
<--- OK
---> AT+FTPPUTPATH="/"
<--- OK
---> AT+FTPPUT=1
<--- OK
---> AT+FTPPUT=2,100
<--- ERROR
---> blahbleeblah
<--- +FTPPUT: 1,1,1360
---> AT+FTPPUT=2,0
<--- OK
---> AT+FTPPUT=2,0
<--- ERROR
---> AT+SAPBR=0,1
<--- +FTPPUT: 1,61

        sendCheckReply(F("blahbleeblah"), F("FTPPUT:1,1"), 30000);

Why do you expect that sending "blahbleeblah" will result in "FTPPUT:1,1" being returned by the FTP server?
What does it ACTUALLY return?

PaulS:

        sendCheckReply(F("blahbleeblah"), F("FTPPUT:1,1"), 30000);

Why do you expect that sending "blahbleeblah" will result in "FTPPUT:1,1" being returned by the FTP server?
What does it ACTUALLY return?

Well it returns +FTPPUT: 1,1,1360, but considering "blahbleeblah" wasn't making it into the file, I wasn't too concerned about listening for the proper reply. Anyways, I did get data to FTP.

A couple findings:

  1. AT+FTPPUT=1 returns "OK". But then a bit later, it returns "+FTPPUT: 1,1,1360". Any requests made before it returns "+FTPPUT: 1,1,1360" result in "ERROR". At the moment I'm just pausing for 10 seconds giving the server the time it needs, but ultimately I need to listen a second time for "+FTPPUT: 1,1,1360" before continuing.

  2. AT+FTPPUT=2,100 works, AT+FTPPUT=2,1000 does not. Even though it should go up to 1360, it doesn't appear to be stable at high values. Currently I'm using "AT+FTPPUT=2,50".

I will start working on a SD card file over the next few days. My thought is that I will have to open the file, then while file.available(), read one character at a time and put it into a character array. Once 50 characters have been read, ftp that character array. Clear character array and read a new 50 characters in, and so on until it's all been sent over. I'll report back my findings.

My thought is that I will have to open the file, then while file.available(), read one character at a time and put it into a character array.

There are multiple read() functions. One takes an array and a size. Read that number of characters in one call, not 50, if the array size is 50.

Hi stoutfiles,
Did you find a solution to this problem?
I am experiencing precisely the same one, file created but left empty.
Regards
Paulo