MiguelB
MiguelB

Reputation: 1

Upload a file to a server usin SIM900

I am trying to upload a file to a server using AT commands and SIM900. First I tried to use HTTP to do it, but I was unable to upload the file. I could transfer data in url encoded and to make POST with the data in the body, however I couldn't send a text file. Now I am trying to upload the file using FTP, but again I am being unable to do it. I have an error opening the FTP session.

The commands i use are as follows (and SIM900 responses):

AT+SAPBR=3,1,"CONTYPE","GPRS" 

OK
AT+SAPBR=3,1,"APN","******"

OK
AT+SAPBR=1,1

OK
AT+FTPCID=1

OK
AT+FTPTYPE="A"

OK
AT+FTPSERV="******"

OK
AT+FTPUN="***"

OK
AT+FTPPW="****"

OK
AT+FTPPUTNAME="111.txt"

OK
AT+FTPPUTPATH="/"

OK
AT+FTPPUT=1 

OK

+FTPPUT:1,66

Any help would be very appreciated. Thanks.

Upvotes: 0

Views: 1627

Answers (1)

Martin Cowie
Martin Cowie

Reputation: 2601

TIL you can use Hayes commands to the SIM900 GPRS module at the serial level to send and receive data via FTP. Gotta wonder why that's an appealing idea, but here goes. This site has a pretty good example. Comparing the two, you both got as far as +FTPPUT:1,66 indicating that you will next send 66 bytes of data. The example implies you can go ahead and type 66 bytes of text, and hit Enter.

You may however find it simpler to use a regular ftp client or library.

Upvotes: 0

Related Questions