The FTPPutFile function uploads the specified file(s) to the FTP server.
Used to upload data on a FTP server or to backup a complete directory structures on a FTP server.
ret=FTPPutFile(<spec_files>,<FTP_foldername> [,Ascii|Binary [,<FTP_filename>])
<spec_files>, string, name of the file(s) to upload. Wildcards (* or ?) may be used to upload files matching a certain mask.
<FTP_foldername>, string, destination FTP folder name for the uploaded file(s). If the folder does not exist, it is automatically created at execution. If the uploaded file(s) already exist in the folder, they are replaced.
ASCII or BINARY, optional keyword. The default is BINARY. Specify ASCII if you upload text files and want to use Ascii.
<FTP_filename>, optional string, destination FTP file name for the uploaded file if only one file is uploaded. If this parameter is not specified or if multiple files are uploaded (and in this last case, even if <FTP_filename> is specified), the filenames on the FTP server are the same as on the PC. If <FTP_filename> includes by mistake a path, the path is not considered and the file is written in <FTP_foldername>.
Ret, optional numeric return value. If the function succeeds uploading the file(s) within 30 seconds, the function returns 0. INCREASE the timeout using #FTPTimeout if the upload takes more than 30 seconds. If the function fails, the return value is a nonzero negative value (see FTP Functions Error Codes).
When files are transferred in ASCII mode, the transferred data is considered to contain only ASCII formatted text. The party that is receiving the transferred data is responsible for translating the format of the received text to one that is compatible with their operating system. The most common example of how this is applied pertains to the way Windows and UNIX handle newlines. On a Windows computer, pressing the "enter" key inserts two characters in an ASCII text document - a carriage return (which places the cursor at the beginning of the line) and a line feed (which places the cursor on the line below the current one). On UNIX systems, only a line feed is used. ASCII text formatted for use on UNIX systems does not display properly when viewed on a Windows system and vice versa.
Binary mode refers to transferring files as a binary stream of data. Where ASCII mode may use special control characters to format data, binary mode transmits the raw bytes of the file being transferred. In this way, the file is transferred in its exact original form.