Right, So I've sent a .txt file to my FTP server via a 3G module, using the following section of code:
Serial.println("AT+CFTPTYPE=A"); //Selects ASCII mode
Serial.flush();
x=0;
do{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
}while(!(data[x-1]=='K'&&data[x-2]=='O'));
Serial.println("AT+CFTPPUT=\"/test.txt\""); //Creates a file and sends data (ASCII)
Serial.flush();
while(Serial.read()!='N'); //Waits 'N' from BEGIN
Serial.println("01234567890123456789"); //Data for the file
Serial.write(0x1A); //End of Data
Serial.write(0x0D); //Carridge return
Serial.write(0x0A); //Line Feed
x=0;
do
{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
}
while(!(data[x-1]=='K'&&data[x-2]=='O')); //Looks for response OK
delay(1000);
Question is, how do I continue to add to it?
If I repeat that code, say in a loop, will it overwrite the file test.txt or will it simply tag on the data at the end?
essentially the test.txt file is going to be used as a log, collecting all data. It will get quite big over time, (the data being sent "01234567890123456789" is not representative of the data actually being sent) so downloading, editing and uploading isn't really a viable solution.... After 2hrs the estimated file size will be 5mb, downloaded and uploaded every second.....