$copytoserver

$copytoserver

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$copytoserver

Copies files from the client side to the server side.

Syntax

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

where

source file namean expression that evaluates to a character string containing a valid file address
destination file namean expression that evaluates to a character string containing a valid file address
file typean 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 absolutethe 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 absolutethe file is written onto the absolute path
source file is relativethe 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 relativenormally, 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%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish