InetFile

Uploads a complete file from your hard drive to the server. Alternately, downloads a complete file from the server to your hard drive.

Synopsis

error = InetFile(fromname, toname, options, attributes)

Args

fromname is the name of the file to be transfered (from the server).

toname is the name given to the file when it is transferred (to your hard drive). If omitted, then the same filename is used as fromname, but the file is placed in the current directory.

options controls the transfer. It may be any of the following, each separated by a | character:

ValueMeaning
RESYNC Transfer the file if it has been modified since the last time it was downloaded.
LINK Force a transfer if there's no Expires time and no LastModified time returned from the server when determining whether the file has been modified.
TEXT Transfer the file as a text file. This would be used if you were retrieving a text file (or something that contains only text, such as a REXX script). The end of line characters are translated to the Windows operating system format. If you do not specify this, then the file is transferred as binary, and no such translation is done. If you transfer a text file as binary, then if the file contains UNIX end of line characters, when you look at it in notepad, all the lines will appear joined together onto one line with an odd character between them.
USETEMP Cause a temporary file to be created if the file can't be cached.
EXISTING Fail if there is already a file on your hard drive with the same filename (in the same directory as you chose to download to). Don't specify this if you don't care about overwriting a file.
RELOAD Force a transfer of the requested file from the server, not from the local cache.
UPLOAD Transfer the file from your hard drive to the server. In this case, fromname is the name of the file on your hard drive, and toname is the name to be given to it on the server.

If omitted, flags defaults to none of the above.

attributes are the attributes bits you wish given to the copy of the file on your hard drive. If omitted, then default attributes are set. (If specifying the "UPLOAD" option, then attributes is ignored).

Returns

An empty string if successful, or an error message if a problem.

Notes

If you call InetFile before calling InetConnectUrl(), InetConnect() or some other function to set the current server handle, then a REXX SYNTAX condition is raised. CONDITION('E') returns error number 40.1 and CONDITION('D') returns the message DLL function "INETFILE" reported server handle not open!.

The EXISTING option does not work in conjunction with the UPLOAD option. You'll have to query for the existance of a file first, if you need to protect against overwriting on the server. Note: If the FTP server is running on an operating system that has case-sensitive filenames, such as UNIX, you may need to specify the filename in the correct case.