parse.multipart: Parsing of POST request multi-part body

Description Usage Arguments Value Note Author(s)

View source: R/parse-multipart.R

Description

parse.multipart parses the result of a POST request that is in a multi-part encoding. This is typically the case when a form is submitted with "enctype='multipart/form-data'" property and "file" input types.

Usage

1
parse.multipart(request = .GlobalEnv$request)

Arguments

request

Request interface object as defined by the FastRWeb interface. parse.multipart will use c.type, c.length and body elements of the object.

Value

On success a named list of values in the form. Scalar values are passed literally as strings, files (multi-part chunks) are passed as lists with named elements content_type, tempfile (file containing the content), filename (name of the file as specified in the encoding,if present) and head (character vector of content headers).

On failure NULL with a warning.

Note

The typical use is along the lines of:

if (grepl("^multipart", request$s.type)) pars <- parse.multipart()

The function uses warnings to communicate parsing issues. While debugging, it may be usedful to convert them to errors via options(warn=2) so they will be visible on the client side.

Author(s)

The original parser code was written by Jeffrey Horner for the Rook package.


cuche27/RWebServer documentation built on May 12, 2017, 1:27 p.m.