AT Commands For FTPS
No | Command | Description |
F1201 | AT+CFTPSSTART | Start FTP(S) service |
F1202 | AT+CFTPSSTOP | Stop FTP(S) Service |
F1203 | AT+CFTPSLOGIN | Login to a FTP(S)server |
F1204 | AT+CFTPSLOGOUT | Logout FTP(S) server |
F1205 | AT+CFTPSMKD | Create a new directory on FTP(S) server |
F1206 | AT+CFTPSRMD | Delete a directory on FTP(S) server |
F1207 | AT+CFTPSDELE | Delete a file on FTP(S) server |
F1208 | AT+CFTPSCWD | Change the current directory on FTP(S) server |
F1209 | AT+CFTPSPWD | Get the current directory on FTP(S) server |
F1210 | AT+CFTPSTYPE | set the transfer type on FTP(S) server |
F1211 | AT+CFTPSLIST | List the items in the directory on FTP(S) server |
F1212 | AT+CFTPSGETFILE | Get a file from FTP(S) server to module |
F1213 | AT+CFTPSPUTFILE | Put a file from module to FTP(S) server |
F1214 | AT+CFTPSGET | Get a file from FTP(S) server to serial port |
F1215 | AT+CFTPSPUT | Put a file to FTP(S) server through serial port |
F1216 | AT+CFTPSSINGLEIP | Set FTP(S) data socket address type |
F1217 | AT+CFTPSCACHERD | Output cached data to MCU |
F1218 | AT+CFTPSABORT | Abort FTP(S) operations |
F1219 | AT+CFTPSSIZE | Get the File Size on FTP(S) server |
F1201 AT+CFTPSSTART Start FTP(S) Service
AT+CFTPSSTART is used to start FTP(S) service by activating PDP context.
You must execute AT+CFTPSSTART before any other FTP(S) related operations.
E) AT+CFTPSSTART |
OK +CFTPSSTART: <errcode> or +CFTPSSTART: <errcode> OK or ERROR |
<errcode> |
The result of start FTP(S) service,0 is success, others are failure. Please refer to chapter 12.3.1. |
Example |
AT+CFTPSSTART OK +CFTPSSTART: 0 |
F1202 AT+CFTPSSTOP Stop FTP(S) Service
AT+CFTPSSTOP Stop FTP(S) Service
E) AT+CFTPSSTOP |
OK +CFTPSSTOP: <errcode> or +CFTPSSTOP: <errcode> OK or ERROR |
<errcode> |
The result of stop FTP(S) service,0 is success, others are failure. Please refer to chapter 12.3.1. |
Example |
AT+CFTPSSTOP OK +CFTPSSTOP: 0 |
F1203 AT+CFTPSLOGIN Login To a FTP(S) Server
AT+CFTPSLOGIN is used to login to a FTP(S) server, you can login to a FTP server by set parameter <server_type> to 0,
login to an implicit FTPS server by set <server_type> to 3 and login to an explicit FTPS server by set <server_type> to1 or 2.
About <sever_type>, more details please refer to defined values <server_type>.
T) AT+CFTPSLOGIN=? |
+CFTPSLOGIN: “ADDRESS”,(1-65535)[,”USERNAME”,”PASSWORD”[,(0-3)]] OK |
W) AT+CFTPSLOGIN=”<host>”,<port>, ”<username>”,”<password>”[<server_type>] |
OK +CFTPSLOGIN: <errcode> or +CFTPSLOGIN: <errcode> OK or +CFTPSLOGIN: <errcode> ERROR or ERROR |
<host> | Host address, string type, maximum length is 256 |
<port> | The host listening port for FTP(S), the range is from 1 to 65535 |
<username> | FTP(S) user name, string type, maximum length is 256 |
<password> | The user password, string type, maximum length is 256 |
<server_type> |
FTP(S)server type,numeric,from0-3,default is 3 0 FTP server. 1 Explicit FTPS server with AUTH SSL. 2 Explicit FTPS server with AUTH TLS. 3 Implicit FTPS server. |
<errcode> |
The result code of the FTP/FTPS login. 0 is success. Others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSLOGIN=”112.74.93.163″,21,”tmf”,”t mf123″,0 OK +CFTPSLOGIN: 0 |
F1204 AT+CFTPSLOGOUT Logout FTP(S) Server
AT+CFTPSLOGOUT is used to logout a FTP(S) sever, make sure you login a FTP(S) sever before you execute AT+CFTPSLOGOUT command.
T) AT+CFTPSLOGOUT=? | OK |
E) AT+CFTPSLOGOUT |
OK +CFTPSLOGOUT: <errcode> or +CFTPSLOGOUT: <errcode> OK or ERROR |
<errcode> | The result code of the FTP/FTPS logout. 0 is success. Others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSLOGOUT OK +CFTPSLOGOUT: 0 |
F1205 AT+CFTPSMKD Create A New Directory On FTP(S) Server
AT+CFTPSMKD is used to create a new directory on a FTP(S) server. Please make sure login to the FTP(S) server successfully before delete a directory.
T) AT+CFTPSMKD=? |
+CFTPSMKD: “DIR” OK |
W) AT+CFTPSMKD=”<dir>” |
OK +CFTPSMKD: 0 or OK +CFTPSMKD: <errcode> or ERROR or +CFTPSMKD: <errcode> ERROR |
<dir> | The directory to be created, string type, maximum length is 256. |
<errcode> | The result of create directory, 0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSMKD=”TEST” OK +CFTPSMKD: 0 |
F1206 AT+CFTPSRMD Delete A Directory On FTP(S) Server
AT+CFTPSRMD is used to delete a directory on FTP(S) server, please make sure login to the FTP(S)server successfully before delete a directory
T) AT+CFTPSRMD=? |
+CFTPSRMD: “DIR” OK |
W) AT+CFTPSRMD=”<dir>” |
1) if delete the directory successfully: OK +CFTPSRMD: 0
2) if delete the directory failed: OK +CFTPSRMD: <errcode>
3) if parameter format or any errors: ERROR |
<dir> |
The directory to be removed. If the directory contains non-ASCII characters, the <dir> parameter should contain a prefix of {non-ascii}.String type, maximum length is 256. |
<errcode> | The result of remove directory, 0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSRMD=”test” OK +CFTPSRMD: 0 |
F1207 AT+CFTPSDELE Delete A File On FTP(S) Server
You can use AT+CFTPSDELE delete a file on FTP(S) server, please make sure login to the FTP(S) server successfully before delete a directory.
T) AT+CFTPSDELE=? |
+CFTPSDELE: “FILENAME” OK |
W) AT+CFTPSDELE=”<filename>” |
1) if delete file successfully: OK +CFTPSDELE: 0
2) if failed: OK +CFTPSDELE: <errcode>
3) if parameter format or any other errors: ERROR |
<filename> |
The name of the file to be deleted. If the file name contains non-ASCII characters, the <filename> parameter should contain a prefix of {non-ascii}.String type,the maximum length is 256. |
<errcode> | The result of delete a file, 0 is success, others are failure,please refer to chapter 12.3.1. |
Example |
AT+CFTPSDELE=”TEST.txt” OK +CFTPSDELE: 0 |
F1208 AT+CFTPSCWD Change The Current Directory On FTP(S) Server
You can use this command to change the current directory on FTP(S) sever. Make sure you have login to FTP(S) server successfully before AT+CFTPSCWD
T) AT+CFTPSCWD=? |
+CFTPSCWD: “DIR” OK |
W) AT+CFTPSCWD=”<dir>” |
1)if delete file successfully:: OK +CFTPSCWD: 0
2)if failed: OK +CFTPSCWD: <errcode>
2)if failed: +CFTPSCWD: <errcode> ERROR
3)if parameter format or any other errors: ERROR |
<dir> |
The directory to be changed. If the directory contains non-ASCII characters, the <dir> parameter should contain a prefix of {non-ascii}.String type,the maximum length is 256. |
<errcode> | The result of change the current directory, 0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSCWD=”/lu.liu/TEST7600″ OK +CFTPSCWD: 0 |
L1209 AT+CFTPSPWD Get The Current Directory On FTPS Server
This command is used to get the current directory on FTPS server. Before AT+CFTPSPWD, please make sure you have login to FTP(S) server successfully.
E) AT+CFTPSPWD |
OK +CFTPSPWD: ”<dir>” or +CFTPSPWD: ”<dir>” OK or +CFTPSPWD: <errcode> ERROR or OK +CFTPSPWD: <errcode> or ERROR |
<dir> |
The name of the file to be deleted. If the file name contains non-ASCII characters, the <filename> parameter should contain a prefix of {non-ascii}. String type, the maximum length is 256. |
<errcode> |
The result of change current directory, 0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSPWD OK +CFTPSPWD: “/test12” |
F1210 AT+CFTPSTYPE Set The Transfer Type On FTP(S) Server
This command is used to set the transfer type on FTP(S) server, please make sure you have login to FTP(S) server before AT+CFTPSTYPE.
T) AT+CFTPSTYPE=? |
+CFTPSTYPE: (A,I) OK |
R) AT+CFTPSTYPE? |
+CFTPSTYPE: <type> OK |
W) AT+CFTPSTYPE=<type> |
a)if set type successfully: OK +CFTPSTYPE: 0
b)if set type failed: OK +CFTPSTYPE: <errcode> |
<type> |
The type of transferring: A ASCII. I Binary |
<errcode> | The result of set type, 0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPTYPE=A OK +CFTPSTYPE: 0 |
L1211 AT+CFTPSLIST List The Items In The Directory On FTP(S) Server
This command is used to list the items in the specified directory on FTP(S) server.
Module will output the items to serial port when list items successfully. Make sure that you have login to FTP(S) server successfully.
AT+CFTPSLIST will list the contents of the current directory on FTP(S) server. You can use AT+CFTPSPWD to get the current directory.
W) AT+CFTPSLIST[=”<dir>”] |
a)if set type successfully: OK +CFTPSLIST: DATA,<len> … +CFTPSLIST: 0
b) if set type failed: OK +CFTPSLIST: <errcode>
c) if parameter format or any other errors: ERROR |
<dir> |
The directory to be listed. If the directory contains non-ASCII characters, the <dir> parameter should contain a prefix of {non-ascii}.String type, the maximum length is 256 |
<errcode> | The result code of the listing.0 is success, others are failure, please refer to chapter12.3.1. |
Example |
AT+CFTPSLIST=”/” OK +CFTPSLIST: DATA,1480 -rw-r–r– 1 ftp ftp 10 Mar 19 13:51 111.TXT -rw-r–r– 1 ftp ftp 7 Mar 18 10:39 1111.txt -rw-r–r– 1 ftp ftp 10240 Mar 23 10:20 112.txt -rw-r–r– 1 ftp ftp 10 Mar 16 15:26 11K4.txt -rw-r–r– 1 ftp ftp 1434 Mar 18 10:47 1434B.txt -rw-r–r– 1 ftp ftp 307200 Mar 18 10:40 300K.txt -rw-r–r– 1 ftp ftp 9 Mar 18 10:53 333.txt -rw-r–r– 1 ftp ftp 16 Mar 17 14:11 36.txt +CFTPSLIST: 0 |
F1212 AT+CFTPSGETFILE Get a File From FTP(S) Server To Module
You can download a file from FTP(S) server to module, by setting parameter <dir>, you can select the directory where to save the downloaded file.
Default the downloaded file will be saved to directory “/cache”. Make sure that you have login to FTP(S) server successfully before AT+CFTPSGETFILE.
Note: By setting <dir> to 4, you can download CA files which is used for SSL verification.
Please don’t download any other large files to this directory, since the space here is limited. Details please refer to
T) AT+CFTPSGETFILE=? |
+CFTPSGETFILE: [{non-ascii}]”FILEPATH”[,(1-4)] OK |
W) AT+CFTPSGETFILE=”<filepath>”[,<dir>[,<offset>]] |
a) if download file successfully : OK +CFTPSGETFILE: 0
b) if failed: OK +CFTPSGETFILE: <errcode>
c) if parameter format or any other errors: ERROR |
<filepath> |
The remote file path. When the file path doesn’t contain”/”, this command transfers file from the current remote FTPS directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii}.String type, maximum length is 256. |
<dir> |
The directory to save the downloaded file.Numeric type, range is 1-4, default is 1(/cache) 1 F:/ (/cache) 2 D:/(sd card) 3 E:/ (/data/media/) 4 /mssl_cert/(this is for CA file downloading) |
<offset> | Integer type, the download start position used or resume-from-break-point. |
<errcode> |
The result code of download file from FTP(s) server.0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSGETFILE=”settings.dat”,3 OK +CFTPSGETFILE: 0 |
F1213 AT+CFTPSPUTFILE Put A File From Module To FTP(S) Server
You can use this command to upload a file to FTP(S) server from module.
By setting parameter <dir> you can select the directory that contains the file to be uploaded.
Make sure that you have login to the FTP(S) server successfully before AT+CFTPSPUTFILE.
T) AT+CFTPSPUTFILE=? |
+CFTPSPUTFILE: [{non-ascii}]”FILEPATH”[,(1-3),(0-2147483647)] OK |
W) AT+CFTPSPUTFILE=”<filepath>”[,<dir>[,<rest_size>]] |
a) if upload file successfully : OK +CFTPSPUTFILE: 0
b) if failed: OK +CFTPSPUTFILE: <errcode> |
<filepath> |
The remote file path. When the file path doesn’t contain “/”, this command transfers file to the current remote FTPS directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii}. String type, maximum length is 256. |
<dir> |
The directory that contains the uploaded file. Numeric type, range is 1-3, default is 1(/cache) 1 F:/ (/cache) 2 D:/(sd card) 3 E:/ (/data/media/) |
<rest_size> |
The value for FTP “REST” command which is used for broken transfer when transferring failed last time. Numeric type, the range is from 0 to 2147483647. |
<errcode> | The result code of upload file to FTP(S)server.0 is success, others are failure, please refer to chapter12.3.1. |
Example |
AT+CFTPSPUTFILE=”/LK/LM/sim_ZXX.TXT” OK +CFTPSPUTFILE: 0 |
F1214 AT+CFTPSGET Get A File From FTP(S) Server To Serial Port
You can use this command to get a file from FTP(S) server to serial port. By setting <using_cache> to 1,
you can use AT+CFTPSCACHERD to output the file data to serial port after “+CFTPS: RECV EVENT” received.
T) AT+CFTPSGET=? |
+CFTPSGET: [{non-ascii}]”FILEPATH”[,<rest_size>[(0,1)]] OK |
W) AT+CFTPSGET=”<filepath>”[,<rest_size>[,<using_cache>]] |
a) if<using_cache> is 0(default),and get file successfully : OK +CFTPSGET: DATA,<len> … +CFTPSGET: DATA, <len> … … +CFTPSGET: 0
b) if <using_cache> is 1 and get file successfully: OK +CFTPS: RECV EVENT
AT+CFTPSCACHERD? //you can use this command to check the size of the received data +CFTPSCACHERD: 102400 OK
//output cached data now: AT+CFTPSCACHERD +CFTPSGET: DATA,<len> …… OK …… +CFTPSGET: 0
c)if failed: OK +CFTPSGET: <errcode> |
<filepath> |
The remote file path. When the file path doesn’t contain ”/”, this command transfer file from the current remote FTPS directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii}. String type, maximum length is 256. |
<rest_size> |
The value for FTP “REST” command which is used for broken transfer when transferring failed last time. Numeric type, the range is from 0 to 2147483647 |
<using_cache> |
Numeric, rang is 0-1 0 Do not use cache, module will output the items data to serial port when list successfully. 1 Use cache, module will report “+CFTPS: RECV EVENT” when list successfully (Data will be output using AT+CFTPSCACHERD command) |
<errcode> |
The result code of download file from FTP(s) server.0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSGET=”/BBB.TXT” OK +CFTPSGET: DATA,110 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHH +CFTPSGET: 0 |
L1215 AT+CFTPSPUT Put A File To FTP(S) Server Through Serial Port
You can put a file to FTP(S) server through serial port. Make sure that you have login to FTP(S) server successfully
T) AT+CFTPSPUT=? |
+CFTPSPUT: [{non-ascii}]”FILEPATH”[,<data_len>[,<rest_size>]] OK |
W) AT+CFTPSPUT=”<filepath>”[ ,<data_len>[,<rest_size>]] |
a)if upload file through serial port successfully: OK +CFTPSPUT: 0
b)if failed before input data: +CFTPSPUT: <errcode> ERROR
c)if failed after input data: OK +CFTPSPUT: <errcode>
d)if parameter format i or any other errors: ERROR |
<filepath> |
The remote file path. When the file path doesn’t contain “/”, this command transfers file to the current remote FTPS directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii}. String type, maximum length is 256. |
<data_len> |
Numeric type, The length of the data to send, the maximum length is 2048. if parameter<data_len> is omitted, Each <Ctrl+Z>character present in the data flow of serial port when downloading FTP data will be coded as <ETX><Ctrl+Z>. Each <ETX> character will be coded as <ETX><ETX>. Single <Ctrl+Z> means end of the FTP data.<ETX> is 0x03, and <Ctrl+Z> is 0x1A. |
<rest_size> |
The value for FTP “REST” command which is used for broken transfer when transferring failed last time. Numeric type, the range is from 0 to 2147483647. |
<errcode> |
The result code of upload data to FTP(s) server.0 is success, others are failure, please refer to chapter 12.3.1. |
Example |
AT+CFTPSPUT=”/LK/LM/LO.TXT” >123457860 OK +CFTPSPUT: 0 |
F1216 AT+CFTPSSINGLEIP Set FTP(S) Data Socket Address Type
This command is used to set FTPS server data socket IP address type.
For some FTP(S) server, it is needed to set AT+CFTPSSINGLEIP=1.
Please make sure to set AT+CFTPSSINGLEIP before AT+CFTPSLOGIN.
T) AT+CFTPSSINGLEIP=? |
+CFTPSSINGLEIP: (0,1) OK |
R) AT+CFTPSSINGLEIP? |
+CFTPSSINGLEIP: <singleip> OK |
W) AT+CFTPSSINGLEIP=<singleip> |
If parameter format is right and set successfully: OK If parameter format is not right or any other error occurs: ERROR |
<singleip> |
The FTPS data socket IP address type: 0 decided by PORT response from FTPS server 1 the same as the control |
Example |
AT+CFTPSSINGLEIP=1 OK |
F1217 AT+CFTPSCACHERD Output Cached Data To MCU
You can use this command to output cached data (generated by AT+CFTPSGET) to MCU.
The parameter <using_cache> of AT+CFTPSGET must be set to 1 when you want to use AT+CFTPSCACHERD.
R) AT+CFTPSCACHERD? |
+CFTPSCACHERD: <len> OK |
E) AT+CFTPSCACHERD |
If cache data is AT+CFTPSGET, and everything goes well: +CFTPSGET: DATA,<out_len><CR><LF> … OK |
<len> |
Numeric type, The bytes of data cached in FTPS module. The bytes of data to output. The maximum value is 1024 for each |
<out_len> | AT+CFTPSCACHERD calling. |
Example |
AT+CFTPSCACHERD? +CFTPSCACHERD: 21078 OK |
F1218 AT+CFTPSABORT About FTP(S) Operations
You can use this command abort any ftp(s) operation. If execute AT+CFTPSABORT, it will logout FTP(S) server and deactive PDP context.
Please make sure you have login to FTP(S) server before AT+CFTPSABORT
E) AT+CFTPSABORT |
if abort FTP(S) operation successfully: OK +CFTPSABORT: 0
sometimes abort successfully returns: +CFTPSABORT: 0 OK
if failed: OK +CFTPSABORT: <errcode>
if any other error occurs: ERROR |
<errcode> | The result of abort FTP(S) service,0 is success, others are failure. Please refer to chapter 12.3.1. |
Example |
AT+CFTPSABORT OK +CFTPSABORT: 0 |
F1219 AT+CFTPSSIZE Get The File Size On FTP(S) Server
You can use this command to get the file size on FTP(S) server.
Please make sure you have login to FTP(S) server before AT+CFTPSSIZE.
T) AT+CFTPSSIZE=? |
+CFTPSSIZE: “<filepath>” OK |
W) AT+CFTPSSIZE=”<filepath>” |
OK +CFTPSSIZE: <filesize> or OK +CFTPSSIZE: <errcode> or ERROR or +CFTPSSIZE: <errcode> ERROR |
<filepath> | The remote filepath on FTP(S) server.String type,max length is 256 |
<filesize> | Numeric type,size of the remote file on FTP(S) server. |
<errcode> | The result code of get file size. Please refer to chapter 12.3.1. |
Example |
AT+CFTPSSIZE=”TEST.txt” OK +CFTPSSIZE: 1024 |