Copies files from the client side to the server side.
$copytoserver(source file name, destination file name, file type)
|source file name||an expression that evaluates to a character string containing a valid file address|
|destination file name||an expression that evaluates to a character string containing a valid file address|
|file type||an expression that evaluates to a character string that starts either with “B” (from “Binary”) or “T” (from “Text”)|
The value return by this function is the file address of the destination if it is executed correctly; otherwise, it will return a $Null value.
This function is designed to work under ZIMTC and copies file from the client side to the server side using the file type specified. Files of the binary type are sent as they are, without their contents being checked (like images, videos, etc). On the other hand, files of the text type are copied using text file conventions for Windows and Unix.
Both the source and the destination file names can be either relative or absolute file paths. The following remarks apply to these paths:
|source file is absolute||the file is taken from the absolute path. Care should be taken because this absolute path refers to a location in the client’s machine; if there are many different users running, all users must have the same valid address|
|destination file is absolute||the file is written onto the absolute path|
|source file is relative||the file is read from a place that is relative to the current directory in the client session which is always where the Zimtc session has been started|
|destination file is relative||normally, the current directory is the database directory; therefore, the file will be written on a place inside the current directory|
If the destination file name contains sub-directories that don’t exist, they are created.
The ZIM executable ignores this function as it makes no sense copying a file to itself.
This example copies the text file from the database path to a fixed location in the server’s machine.
out $copytoserver(“mytext.txt”, “c:\mextext.txt”, “T”)