FTPPUT failing when copying from sd to server

I am using Arduino and I am having difficulty sending a file all responses are returned as ok except for Send(“AT+FTPPUTFRMFS=“myFile””); my code is as followed:

#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>

String Arsp, Grsp;
SoftwareSerial gsm(2, 3); // RX, TX

File myFile;

void setup() {
  Serial.begin(9600);
  Serial.println("Testing GSM SIM800L");
  gsm.begin(4800);


  Serial.print("Initializing SD card...");

  if (!SD.begin(10)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");


  Send(F("AT+CREG?"));
  printScreen();
  Send(F("AT+SAPBR=3,1,\"Contype\",\"GPRS\"" ));
  printScreen();
  Send(F("AT+SAPBR=3,1,\"APN\",\"internet\"" ));
  printScreen();
  Send(F("AT+SAPBR=1,1" ));
  printScreen();
  Send(F("AT+FTPCID=1" ));
  printScreen();
  Send(F("AT+FTPSERV=\"xxx\"" ));
  printScreen();
  Send(F("AT+FTPPORT=21 " ));
  printScreen();
  Send(F("AT+FTPUN=\"xxxx\"" ));
  printScreen();
  Send(F("AT+FTPPW=\"xxxx\"" ));
  printScreen();
  //myFile = SD.open("datalog.txt");
  Send(F("AT+FTPPUTNAME=\"datalog.txt\""));
  printScreen();
  Send(F("AT+FTPPUTPATH=\"/\"" ));
  printScreen();
  File myFile = SD.open("datalog.txt");
  Send("AT+FTPPUTFRMFS=\"myFile\"");
  printScreen();
  Send(F("AT+FTPPUTFRMFS?"));
  printScreen();
  /*Send(F("+FTPPUT: 1,0"));
  printScreen();
  Send(F("+FTPPUT: 0"));
  printScreen();*/
  myFile.close();
  Send(F("AT+SAPBR=0,1"));
  printScreen();
}

void loop(){}

void Send(String Command) {
  gsm.println(Command);
  //delay(t);
}

void printScreen() {
  while (gsm.available() == 0) {}
  if (gsm.available()) {
    Grsp = gsm.readString();
    Serial.println(Grsp);
  }
}

Why are you using AT+FTPPUTFRMFS?
Is your SD card interfaced to SIM800 or to Arduino?

I have tried FTPPUTFRFMS and FTPFILEPUT both no success, the SD card module is connected to arduino

OK then you should use FTPPUT only , not file put. Because SD card is not connected to SIMCOM module.
If i am correct, the commands you mentioned above are used to send files from SD card which is connected to SIMCOM module.

Sorry if I’m a little confused but if my understanding is correct that is to set the data lenths

AT+FTPPUT=2,100 is used to tell, am sending 100 bytes
+FTPPUT: 2,100 is response for module that you can start entering the 100 bytes

… Here you should enter the 100 bytes of file contents

You have to read SD card file contents into a buffer and then write to file on server using FTPPUT.
Commands in this video should work.

Ok so what has to happen is I have to put it in a string variable and then send it and as the max is 1kbyte I have break larger file into smaller files

Correct, Thats how i did it.

Cool I am really grateful for the help.

1 Like

can u send me the
updated code?

any body alive??? >>>