Specify information about a file to upload in an HTTP request
This function creates an object that describes all of the details
needed to include the contents of a file in the submission of an
HTTP request, typically a multi-part form submitted via
postForm
.
The idea is that we want to transfer the contents of a file or a
buffer of data within R that is not actually stored on the file
system but is resident in the R session. We want to be able to
specify either the name of the file and have RCurl read the contents
when they are needed, or alternatively specify the contents ourselves
if it makes sense that we already have the contents in R, e.g. that
they are dynamically generated. Additionally, we may need to specify
the type of data in the file/buffer via the Content-Type field for
this parameter in the request.
This function allows us to specify either the file name or contents
and optionally the content type.
This is used as an element in of the params
argument
postForm
and the native C code understands and processes
objects returned from this function.
fileUpload(filename = character(), contents = character(), contentType = character())
filename |
the name of the file that RCurl is to pass in the form
submission/HTTP request. If this is specified and no value for
|
contents |
either a character vector or a |
contentType |
a character string (vector of length 1) giving the type of the content, e.g. text/plain, text/html, which helps the server receiving the data to interpret the contents. If omitted, this is omitted from the form submission and the recipient left to guess. |
An object of (S3) class FileUploadInfo
with fields
filename
, contents
and contentType
.
Duncan Temple Lang
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.