Hey Blake, thanks for the explanation.I know its too old post but still trying my luck to contact you. I am going through a similar problem. I have a filed in SD card which i want to read and upload it on the web server over 2G modem SIM800L via ESP32. I am facing similar problem, here is my code.
if (File1) {
int i = 0;
while (File1.available()>0) {
char_buffer = File1.read();//Takes one by one character in char_buffer from File.read()
Serial.println("char_buffer: " + String(char_buffer));
string_buffer.concat(char_buffer);//Concats every single character from char_buffer and makes string_buffer
Serial.println("string_buffer: " + String(string_buffer));
i++;
if (i == buffer_space) {
sendATcommand("AT+FTPPUT=2," + String(buffer_space), "AT+FTPPUT=2,10", "ERROR", 1000);
sendATcommand(string_buffer, "OK", "ERROR", 5000);
string_buffer = "";
i = 0;
}
}
if (string_buffer != ""){
sendATcommand("AT+FTPPUT=2," + String(i), "AT+FTPPUT=2,10", "ERROR", 1000);
sendATcommand(string_buffer, "OK", "ERROR", 5000);
sendATcommand("AT+FTPPUT=2,0", "OK", "ERROR", 1000);
}
File1.close();
}
If my file size is small, i have a successful upload, but if i have a large file, the loop keeps going on and uploads more than the file size, i have to stop the operation. If i stop and read the file on server, it has garbage text at the end.
I guess its because of the problem you just defined. Can you let me know how can i solve it in this code?