Fields

name. Name of file
$some_file.name

The field contains the name of file. Object of class
file has field name if a visitor has uploaded the file through form field <input type=file>. Constructor file::load may also provide an alternative name of file.

size. Size of file
$some_file.size

The field contains size of file in bytes.

text. Text of file
$some_file.text

The field contains text of file. By using this field, one can output the content of text files or text resulted from
file::cgi and file::exec.
Note: automatic end of lines (EOL) normalization is made for text files (mode=text), but not for binary files (mode=binary). For normalizing EOL characters in binary files, that come from form for example, you have to use the following code:
$f[^file::create[$form:file;$.mode[text]]
$f.text


Information about file
$some_file.size-size of file in bytes;
$some_file.cdate-creation date;
$some_file.mdate-modification date;
$some_file.adate-last access date.

These fields available if object was created within constructor
file::stat or file::load by loading local file   [3.3.0].

stderr. Standard error text of program execution
$some_file.stderr

After
file::cgi and file::exec here goes text from standard error program stream.

status. Status of getting this file
$some_file.status

After
file::cgi and file::exec in status field one can find status of program execution (success=0).
After
file::load from HTTP-server here is status of HTTP request (success=200).

mode. File's mode.   [3.4.0]
$some_file.mode

Could be text or binary.

content-type. MIME-type of file
$some_file.content-type

The field may contain file's MIME-type. If a cgi-script is executed (see
file::cgi) MIME-type may be specified by the script-in header "content-type". If a file is loaded (see file::load) or its status is retrieved (see file::stat) MIME-type will be defined with the help of table $MAIN:MIME-TYPES (see "Configuration method"), If file extension cannot be located in the table, MIME-type will be defined as "application/octet-stream."

HTTP response headers
$some_file.HTTP_RESPONSE_HEADER

If a file was loaded from an HTTP-server, HTTP response headers will be accessible in UPPERCASE as fields of object of class
file.

$some_file.HTTP_RESPONSE_FIELD (in UPPERCASE)

For example:
$some_file.SERVER.

If one response header occurs in a response several times, all its values are accessible in
tables field:

$.tables[
   $.HTTP_RESPONSE_FIELD[
table of values with sole column value]
]


Example:
$f[^file::load[binary;http://www.parser.ru/en/]]
^f.tables.foreach[key;value]{
    $key=^value.menu{$value.value}[|]<br />
}



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 08.10.2012