There are several different tags in SteelArrow for doing file operations. These
tags allow the developer to setup secure systems for file uploads, and reading/writing
of textual file data.
The FILE tag offers functionality for reading an writing
data using an absolute path. To offer a secure version of this tag, its functionality
was split in two, between the READFILE and
WRITEFILE tags. These tags are a secure solution since
they do not allow absolute paths, and instead use paths relative to the directory contianing
the script being executed. Though READFILE and WRITEFILE use relative paths, they do not
allow the use of '..' (parent directory) or '.' (current directory).
Each of these tags are further secured by having the ability to be disabled on any system.
As well, user or group enabling of these tags is possible with system configuration.
Further to this, the IMPORT, READFILE and
WRITEFILE tags support virtual directories. These
directories can be configured on a per user basis. This allows for the central storage of data across
different applications on the server using these tags. If a path (usually specified in the FILE=
attribute) begins with the backslash character '\', the file path will be resolved as a virtual one.
(a forward-slash can also be used)
The FILE tag supports the following actions;
RENAME | Rename a file |
COPY | Copy a file |
DELETE | Delete a file |
CREATEDIR | Create a directory |
LIST | List a directory |
SIZE | Retrieve size of a directory or file |
UPLOAD | HTML file upload functionality |
The following code snippets show examples of the functionality:
<!--- RENAME a file --->
<SAFILE SRC="oldFile.dta" DEST="newFile.dta"
ACTION="RENAME">
<!--- COPY a file --->
<SAFILE SRC="origFile.dta" DEST="opyFile.dta"
ACTION="COPY">
<!--- DELETE a file --->
<SAFILE SRC="file2delete.dta" ACTION="DELETE">
<!--- CREATEDIR a file --->
<SAFILE SRC="dir2create" ACTION="CREATEDIR">
<!--- LIST directory contents --->
<SAFILE SRC="dir2list" ACTION="LIST" NAME=dirList>
<!--- Retrieve SIZE of a directory --->
<SAFILE SRC="dir2list" ACTION="SIZE" NAME=dirSize>
<!--- Retrieve SIZE of file --->
<SAFILE SRC="file2size.dta" ACTION="SIZE" NAME=fileSize>
<!--- HTML UPLOAD of file --->
<SAFILE FILEDATA=fileField DEST="uploadFile.dta"
ACTION="UPLOAD">
|