NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_getform(n) 5.0.0a naviserver "NaviServer Built-in Commands"

Name

ns_getform - Return an ns_set that contains all of the query data that was part of the HTTP request

Table Of Contents

Synopsis

Description

This command returns a handle to an ns_set which contains all of the query data from the current HTTP request. The resulting data includes query parameters passed in the URL as well as multipart form data. If there is no form data, an empty ns_set is created.

COMMANDS

ns_getform ?-fallbackcharset charset? ?defaultcharset?

The command ns_getform gets form data from GET or POST requests and processes the data either in the spool file or in memory.

For GET requests ns_conn form and ns_getform are identical. The command handles content-types application/x-www-form-urlencoded and multipart/form-data.

For uploaded files two additional elements are created in the ns_set, named input_name.content-type and input_name.tmpfile. The filename for the temporary file is generated by ns_mktemp, the file is deleted automatically, when the connection is closed.

In case in the provided form data contains invalid UTF-8 text, an exception is raised (with exception code NS_INVALID_UTF8). When the global or per-server configuration variable formfallbackcharset is provided, a second decoding attempt is made with this charset and a warning is generated when invalid UTF-8 data is encountered. Note that the second attempt using the fallback charset is made as well, when an invalid charset was provided with in the content-type header field. By using the option -fallbackcharset charset the fallback charset can be specified explicitly, which overrides the configuration parameters.

  ns_getform -fallbackcharset windows-1252

When the provided content-type header field type contains no charsetl specification, the configuration variable urlcharset can be used. In order to override the configuration value, the parameter defaultcharset can be passed to ns_getform. The parameter should not be confused with the fallback charset which is only used when decoding results in invalid UTF-8.

  ns_getform iso8859-1

See Also

ns_atclose, ns_conn, ns_getcontent, ns_getformfile, ns_mktemp, ns_parsequery, ns_queryget, ns_set

Keywords

content-type, form, formfallbackcharset, urlcharset