$Web File Content: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 18: Line 18:
<tr><th>type</th>
<tr><th>type</th>


<td><table class="syntaxTable">
<td>
<td>A case-independent string set to one of the following:</td></tr>
<table class="syntaxTable">
<td colspan="2">A case-independent string set to one of the following:</td></tr>
<tr><th>Text</th>
<tr><th>Text</th>
<td>The data is text and is to be translated from ASCII to EBCDIC.</td></tr>
<td>The data is text and is to be translated from ASCII to EBCDIC.</td></tr>
Line 25: Line 26:
<td>The data is to be left unchanged.</td></tr>
<td>The data is to be left unchanged.</td></tr>
<tr><th>TextUtf8</th>
<tr><th>TextUtf8</th>
<td>The data is UTF-8 and is to be converted to EBCDIC: each two-byte UTF-8 sequence is converted to the corresponding ASCII character, which is then translated to EBCDIC using the translation table in effect for the ''[[Janus Web Server]]'' connection. This option was first provided as maintenance to ''[[Sirius Mods]]'' version 7.3.
<td>The data is UTF-8 and is to be converted to EBCDIC: each two-byte UTF-8 sequence is converted to the corresponding ASCII character, which is then translated to EBCDIC using the translation table in effect for the ''[[Janus Web Server]]'' connection. This option was first provided as maintenance to ''[[Sirius Mods]]'' version 7.3.</td></tr>
</td></tr>
</table>''type'' is an optional argument, and it defaults to <tt>Binary</tt>.</td></tr></table>
</table>''type'' is an optional argument, and it defaults to <tt>Binary</tt>.</td></tr></table>



Revision as of 20:41, 22 February 2011

<section begin="desc" />Retrieve input contents<section end="desc" />


$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

<section begin="syntax" /> %LSTR = $Web_File_Content( name, occurrence, type ) <section end="syntax" />


$Web_File_Content takes three arguments and returns a longstring.

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:
Text The data is text and is to be translated from ASCII to EBCDIC.
Binary The data is to be left unchanged.
TextUtf8 The data is UTF-8 and is to be converted to EBCDIC: each two-byte UTF-8 sequence is converted to the corresponding ASCII character, which is then translated to EBCDIC using the translation table in effect for the Janus Web Server connection. This option was first provided as maintenance to Sirius Mods version 7.3.
type is an optional argument, and it defaults to Binary.

Notes:

  • 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"

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 the Sirius Functions Reference Manual) or Stringlist parsing methods (see the Janus SOAP Reference Manual -- the Stringlist class ParseLines method is likely to be particularly helpful).

$Web_File_Content is available only in Versions 6.7 and later of the Sirius Mods.

See also $Web_Output_Content and $Web_Input_Content.