The TransactFileToClient function allows a file to be transferred from the server to the client.
Syntax | |||||
TransactFileToClient(SourceFile [, DestFile] [, AlwaysTransact] [, CreateDirectory]) | |||||
Return value | |||||
Type |
Description | ||||
Long |
0 if function could be successfully executed | ||||
Parameter | |||||
Use |
Name |
Type |
Passing |
Description | |
Required |
SourceFile |
String |
ByVal |
Path to the server file to be transported to the client. Wildcards are not allowed. Predefined directories are supported. | |
Optional |
DestFile |
String |
ByVal |
Path to the file at the client. See Note. | |
Optional |
AlwaysTransact |
Boolean |
ByVal |
Overwrite the file if it already exists | |
Optional |
CreateDirectory |
Boolean |
ByVal |
Create directories with the client if required | |
Note
The file path on the client is only allowed in absolute form (with drive specification).
The function supports predefined directories:
Begriff |
Description |
[TMPDIR] |
Current temp directory at the client or server The directory is often located in the user directory, e.g. C:\Users\Benutzer.Domäne\AppData\Local\Temp |
[APPDIR] |
The TCE program directory at the client or server, often C:\Program Files (x86)\TAP.CON\TCE |
[WINDIR] |
The Windows directory at the client or server, often C:\Windows |
[SYSDIR] |
The system directory at the client or server, often C:\Windows\System32 |
[APPDATADIR] |
The application data directory at the client or server, e.g. C:\Users\Benutzer.Domäne\AppData\Roaming |
[PROGDATADIR] |
The program data directory at the client or server, e.g. C:\ProgramData |
Return of the function is 0 on success or the error code of the transfer.
Example:
Server.TransactFileToClient("C:\DataForClients\setting.xml", "[APPDATADIR]\TCE\ settings.xml",, True)
The server-side file C:\DataForClients\setting.xml is copied to the client in the directory C:\Users\Benutzer.Domäne\AppData\Roaming\TCE\settings.xml. If the TCE directory does not exist, an attempt is made to create it. If the server-side file does not exist, the function returns 53 (file does not exist).