Managing Files in the Storage Area
This document describes how to manage files in the storage area in "classic" mode.
For safety reasons, the manipulation of files between the client and the server has to apply the following rules:
A Sage X3 storage area is a limited area of the server file system that manages user files. It is created by an administrator using the volumes management function:
ROOT
parameter set by the administrator.Example: If the root property of the TMP storage area of MYFOLDER is set to "tmp", and the installation path of the folder is c:\sage\$$prod\mysolutionX3\MYFOLDER:
ROOT
parameter equal to "tmp" will correspond to a storage path equal to c:\sage\$$prod\mysolutionX3\MYFOLDER\tmp on a Windows server.A dedicated DSYRFICREP window was implemented to select a file in a storage area. It is displayed on the select
event of the ASTO
type, which was created to manage storage area files.
Users can select a file by using the DSYRFICREP window, or by entering paths. In both cases, the logical path can be controlled by using the CTL_VOLFIL function implemented in the ASYRSTO
script.
The CTL_VOLFIL function returns a code which can be used to set the mkstat
variable. It can receive the following parameters:
Parameter | Description | Expected values |
---|---|---|
CLISRV (in) | Type of file | 1: client. 2: server. |
PATH (in) | File logical path | Syntax = [volume]/file. |
FULLPATH (out) | File physical path | - |
TYPE (in) | Type of operation | E_TYPE_FILEREAD: controls that the file exists. E_TYPE_FILEWRITE: controls that the file can be created. E_TYPE_FOLDER: controls that the folder exists. |
MESSAGE (out) | Error message | Error message set if the function returns a value greater than 0. |
Note: A simple way to adapt a mask to use the storage area is to:
Example:
#set the 'enum' values (E_TYPE_FILEREAD...)Gosub ENUM_VOLFIL_TYPE From ASYRSTO# control the logical path set in VALEUR and set the physical path in [M]FICHIERmkstat = func ASYRSTO.CTL_VOLFIL([M]TYPEXP,VALEUR,[M]FICHIER,E_TYPE_FILEREAD,GMESSAGE)
Download operations are automatically managed by the ORDSYS COPCLI function. Because the user cannot select the destination of the downloaded file, the ASTO field has to be grayed out.
Upload operations are automatically managed by the ORDSYS COPSRV function. Because users cannot select the destination, files are uploaded in the TMP storage area, where they are stored as temporary files.
As a consequence, the behavior of the second parameter was changed to return the physical path of the file uploaded on the server. Scripts may have to be slightly changed to prevent users from seeing the physical path. Because the user cannot enter the origin of the field to upload, the ASTO field has to be grayed out.