Upload a file to an FTP site
The FTPUPLOAD program can be used to upload a file to an FTP site. It is intended for use in postprocessing where it may be necessary to upload files for further processing. The localfile parameter must be a full pathname, optionally with wildcards in the filename part. If the pathname contains blanks, it must be enclosed in double-quotes.
The -p parameter forces passive mode FTP. Before using this mode, you must ensure it is supported by the FTP server. If you use active mode, you may need to configure your own firewall to allow the FTP server to select the data port. Setting an environment variable FTPUPLOAD_METHOD to either PASSIVE or ACTIVE is an alternative to the command-line option and overrides it if different.
The -rel parameter causes the folder name immediately following the first single / to be taken as a relative folder name - relative to the folder set automatically by the server on login. Without this option the folder is taken as a root folder of the FTP site. Setting an environment variable FTPUPLOAD_FOLDER to either RELATIVE or ROOT is an alternative to the command-line option and overrides it if different.
The -h parameter hides the window. The sequence of the three command-line options on the command line is not significant.
The ftpspec parameter (enclosed in double-quotes if it contains blanks) comprises a number of required and optional components in the following sequence:
|filetype||the prefix ftp:// is required.|
|login||A login name and password, separated by a colon (:) and followed by an at sign (@) is required. The password may also contain an @, which is often the case with anonymous login.|
|host||The name of the FTP server is required.|
|port||An optional command port number may be given, preceded by a colon (:). The default port number is 21.|
|path||A path is required. To save in the root of the FTP site, use a single forward slash (/). The path must use forward slash characters, not backslash, and must always end in a forward slash. Note that the pathname may be case-sensitive at some FTP servers.|
|filename||An optional filename may be given. If omitted, the filename of the source file is used. The filename must be omitted if the localfile contains wildcard characters.|
The optional .ext parameter contains a file extension (with leading .) which will be used to rename the local file if the transfer is successful. This can be used to prevent a second transfer if the upload is re-run with the same local file specification.
The program does not terminate until the transfer is complete. A status window is displayed during operation. If the transfer fails, a non-zero errorlevel is returned, which may be tested in a batch file. The error can be viewed (briefly) in the status window, or can be recorded using FFTRACE.
Login through a proxy is not currently supported. Please contact Copia support if you require this feature. All uploads are done in binary mode.
Upload file myfile.zip to ftp.copia.com, creating a file of the same name in folder UPLOAD (note the final forward slash character), and using anonymous login with a password of an e-mail address:
FTPupload myfile.zip ftp://anonymous:email@example.com@ftp.copia.com/UPLOAD/
Upload file myfile.zip to ftp.copia.com in passive mode, creating a file named myupload.zip in folder UPLOAD, and using a specific login (tim) and password (xyzzy):
FTPupload -p myfile.zip ftp://tim:firstname.lastname@example.org/UPLOAD/myupload.zip