load. Loading file from disk or HTTP-server

format;filename;download options]
format;filename;new filename]
^file::load[format;filename;new filename;download options]

Loads file from disk or HTTP-server.

Format defines format of loaded file and can be either text or binary. The two types differ in newline characters. For PC these characters are 0D 0A. If file is being loaded in format text, 0D will be deemed unnecessary and truncated. These characters will be added back to the file by method save.

Filename-name of file with path or file's URL on HTTP-server.

It should be kept in mind that if argument
new filename is specified, its value will be assigned to field name. This argument is especially useful in dealing with method mail:send to send a file with needed name.

Download options
-see "Working with HTTP-servers".

If a file was loaded from an HTTP-server, fields of HTTP-response headers can be accessed as fields of object of class
Also there would be field tables, hash, keys of which are HTTP-response headers in upper case, and values are tables with sole column value, containing all values of HTTP-response fields of same name.
All incoming
cookies are stored in field cookies as a table with columns name, value, expires, max-age, domain, path, httponly and secure.   [3.4.2]

Example of downloading file from disk
File $f.name is $f.size in size and has the text:<br />

Example of downloading file from HTTP-server
Server software: $file.SERVER
<hr />

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