FTPc_SendFile

Sends a file from the file system.

Files

ftp-c.h/ftp-c.c

Prototype

          CPU_BOOLEAN  FTPc_SendFile (FTPc_CONN    *p_conn,
                                      CPU_CHAR     *p_remote_file_name,
                                      CPU_CHAR     *p_local_file_name,
                                      CPU_BOOLEAN   append,
                                      FTPc_ERR     *p_err);

Arguments

p_conn

Pointer to FTPc Connection object.

p_remote_file_name 

Pointer to name of the file on the remote FTP server.

p_local_file 

Pointer to name of the file in the local file system.

append 

Whether to append at the end of the existing file or overwrite content:
DEF_YES, to append data to file.
DEF_NO,  to overwrite file content.

p_err

Pointer to variable that will receive the return error code from this function:

FTPc_ERR_NONE
FTPc_ERR_TX_CMD
FTPc_ERR_RX_CMD_RESP_FAIL
FTPc_ERR_FILE_OPEN_FAIL

Returned Values

DEF_OK,      File successfully sent.
DEF_FAIL, otherwise.

Required Configuration

  • This function can only be used when FTPc_CFG_USE_FS is set tot DEF_ENABLED.

Notes / Warnings

None.

Example Usage

FTPc_CONN    conn;
CPU_BOOLEAN  result; 
FTPc_ERR      err; 
           
result = FTPc_SendFile(&conn,
                       "test",
                       "\\test",
                        DEF_NO,
                       &err);
if (result != DEF_OK) {
	printf("FTPc_SendFile() failed.\n\r");
}