613-518-1166 info@zimdatabases.com

ZIM Language Reference

$copytoserver

< All Topics

Copies files from the client side to the server side.

Syntax

$copytoserver(source file name, destination file name, file type)

where

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”)

Return Value

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.

Comments

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.

Example

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”)

Related Topics

$copytoclient

 

 

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents