How to send a file in ftp on SIM900A

Status
Not open for further replies.

chippevijaya

Member level 1
Joined
Apr 26, 2013
Messages
33
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
1,549
Hi Friends,
I did the FTP in SIM900 module. everything works well. I created a file in FTP host using FTPNAME and entered data during FTPPUT, and finally created a file in FTP server successfully.

But can I send a file to FTP server? I need to load a file(*.*) from a path in local computer and send it with SIM900 to FTP server. Can I perform this operation?
--
Vijaya Kumar
 


try:
FTPPUTNAME,
FTPPUTPATH then
FTPPUT
 

Hi Sirzbf,
I am confused with the commands:
FTPPUTNAME-----------------name of the file
FTPPUTPATH-----------------I think this is the path of FTP server(not the local computer one) where the file has to create, correct me if am wrong!!
FTPPUT-----------------------making ready for file loading
FTPPUT=2,1000--------------this will create file of 1000 bytes!
but i need to give path of local file from desktop
===================================================
And here is my python code It works well, but ftp file data need to entry in command prompt
import serial
import RPi.GPIO as GPIO
import os, time

GPIO.setmode(GPIO.BOARD)

# Enable Serial Communication
gsm = serial.Serial("/dev/ttyusb0", baudrate=9600, timeout=1)


print("opened port : "+gsm.portstr)

if gsm.isOpen():
#1
gsm.write(b'AT\r\n')
time.sleep(0.5)
#2
gsm.write(b'ATE0\r\n')
time.sleep(0.5)
#3
gsm.write(b'AT+SAPBR=3,1,"CONTYPE","GPRS"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#4
gsm.write(b'AT+SAPBR=3,1,"APN","TATA.DOCOMO.INTERNET"\r\n')
time.sleep(0.5)
#5
gsm.write(b'AT+SAPBR=3,1,"USER",""\r\n')
time.sleep(0.5)
#6
gsm.write(b'AT+SAPBR=3,1,"PWD",""\r\n')
rcv = gsm.read(20)
time.sleep(3)
#7
gsm.write(b'AT+SAPBR=1,1\r\n')
time.sleep(3)
#8
gsm.write(b'AT+SAPBR=2,1\r\n')
time.sleep(1)
#9
gsm.write(b'AT+FTPCID=1\r\n')
time.sleep(0.5)
#10
gsm.write(b'AT+FTPMODE=1\r\n')
time.sleep(0.5)
#11
gsm.write(b'AT+FTPSERV="ftp.drivehq.com"\r\n')
time.sleep(0.5)
#12
gsm.write(b'AT+FTPPORT=21\r\n')
time.sleep(0.5)
#13
gsm.write(b'AT+FTPUN="******"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#14
gsm.write(b'AT+FTPPW="******"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#15
gsm.write(b'AT+FTPPUTNAME="Demo.txt"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#16
gsm.write(b'AT+FTPPUTPATH="/"\r\n')
time.sleep(0.5)
#17
gsm.write(b'AT+FTPPUT=1\r\n')
time.sleep(1)
#18
gsm.write(b'AT+FTPPUT=2,74\r\n')
time.sleep(1)
gsm.write(b"This file is loaded from PYTHON script SIM900 GSM**************\r\n") //here i want load a file(*.txt) from "C:\data to load\new.txt"
#gsm.write(b'\x1a') //and file size may vary so what I have give at FTPPUT=2,xxx?
time.sleep(2)
#19
gsm.write(b'AT+FTPPUT=2,0\r\n')
time.sleep(6)
#20
gsm.write(b'AT+SAPBR=0,1,"CONTYPE","GPRS"\r\n')
time.sleep(1)

Please suggest any solution...........
 

FTPPUTPATH--> is the path in FTP server where you want the file to be put into.

if i read your post correctly , then are you having error in FTPPUTNAME command when you execute? or something else...?
 

Thank you for your reply srizbf,
No errors in my program, I successfully created a file in the server and loaded the data as shown in above program.....
My another requirement is "I have to choose a file in my computer with AT commands and upload it to FTP server"


If we can upload!! how to send command of file size!!!!!
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…