$copytoclient

$copytoclient

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$copytoclient

Copies files from the server side to the client side.

Syntax

$copytoclient(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 server side to the client 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
destination file is absolutethe file is written onto 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
source file is relativenormally, the current directory is the database directory; therefore, the file will be taken from an address calculated inside the current directory
destination file is relativethe file goes to place that is relative to the current directory in the client session which is always where the Zimtc session has been started; therefore, if the file is needed for subsequent operations, then the same relative path must be used. If the file will be needed after the current session is finished, then it is suggested to provide an absolute path to the destination file as Zimtc does not guarantee that files will be preserved after the session finishes

Because ZIMTC actually acts like a Web Browser in most respects, the client side (managed by ZIMTC) does not have the files needed to perform certain operations which should be located in a place only known by the server. This situation is specially important when the file is needed by an external processing capability like an ActiveX component or any other program that uses a file without the direct control of ZIMTC.

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 is an invocation of an ActiveX property to edit the file specified. It reads the file from a fixed location but writes it to the directory where the session has been started.

let vResult = $objsetproperty(Object, "image", $copytoclient("c:\myfiles\myimage.bmp", "myfiles\myimage.bmp", "binary"))

This example copies the text file from the database path to a fixed location in the client’s machine.

out $copytoclient("mytext.txt", "c:\mextext.txt", "T")

Related Topic

$copytoserver

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.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese