$Web_File_Content
Retrieve input contents
$Web_File_Content retrieves the "content" of a file that was sent using the multipart/form-data format on an HTTP Post. $Web_File_Content returns this content as a longstring.
Syntax
%lstr = $Web_File_Content( [name], [occurrence], [type] )
%lstr | A Longstring variable for the returned content. | ||||||
---|---|---|---|---|---|---|---|
name | The name of the form field specified as <input type="file"...> from which content is to be retrieved. This is an optional argument; if it is not specified, all form fields are considered to match the request. | ||||||
occurrence | The occurrence number of the form field specified as <input type="file"...> that matches the first argument from which content is to be retrieved. This is an optional argument; if it is not specified, content is retrieved from the first form field that matches the name argument. | ||||||
type | A case-independent string set to one of the following:
|
Usage notes
- Interplay of the name and occurrence arguments:
- If both field name (argument 1) and field occurrence (argument 2) are set, the indicated occurrence of the indicated field is retrieved.
- If the field name is set, and the field occurrence is not, the first occurrence of the indicated field is retrieved.
- If the field name is not set, and the field occurrence is, the indicated field number is retrieved regardless of its name. That is, if occurrence number 4 is requested, the fourth received field is retrieved.
- If neither the field name nor the field occurrence is set, the first field is retrieved regardless of its name.
- A null is returned by both of these:
- A request for a field that was not uploaded
- A request for a field that has no file content, because it was not specified as
<input type="file"...>
on the HTML page, or because the HTML form was not specified withenctype="multipart/form-data"
Note: Text data retrieved by $Web_File_Content is not affected by the setting of the JANUS DEFINE, JANUS WEB ON, or $Web_ProcSend parameters CR, LF, or CRLF. But to facilitate subsequent parsing, ASCII carriage returns (X'0D') and linefeeds (X'0A') that a client sends as line-separators are translated by $Web_File_Content to EBCDIC carriage returns (X'0D') and linefeeds (X'25').
- Having the file content as a single longstring might be inconvenient for many applications, especially if the data is line-oriented. It is the application's responsibility to parse this longstring using either longstring parsing functions (see Longstrings) or Stringlist parsing methods (see List of Stringlist methods — the Stringlist class ParseLines method is likely to be particularly helpful).