httr (version 0.3)

POST: POST file to a server.

Description

POST file to a server.

Usage

POST(url = NULL, config = list(), ..., body = NULL, multipart = TRUE,
  handle = NULL)

Arguments

body
One of the following:
  • FALSE: No body
  • NULL: An empty body
  • A length one character or raw vector: sent as is in body.
  • A named list: Each component should either be a string or the object returned
multipart
Should the form be send as multipart/form-data (TRUE), or application/x-www-form-urlencoded (FALSE). Files can not be uploaded when FALSE.
url
the url of the page to retrieve
config
Additional configuration settings such as http authentication (authenticate), additional headers (add_headers), cookies (
...
Further parameters, such as query, path, etc, passed on to modify_url. These parameters must be named.
handle
The handle to use with this request. If not supplied, will be retrieved and reused from the handle_pool based on the scheme, hostname and port of the url. By default httr requests to th

Examples

Run this code
b <- new_bin()
POST(b)
POST(b, body = "A simple text string")
POST(b, body = list(a = 1, b = 2, c = 3))
POST(b, body = list(a = 1, file = upload_file(system.file("CITATION"))))

b2 <- "http://httpbin.org/post"
POST(b2, body = "A simple text string")
POST(b2, body = list(x = "A simple text string"))
POST(b2, body = list(y = upload_file(system.file("CITATION"))))

Run the code above in your browser using DataLab