Arguments
- path
path to file
- type
mime type of path. If not supplied, will be guess by
mime::guess_type()
when needed.
Examples
citation <- upload_file(system.file("CITATION"))
POST("http://httpbin.org/post", body = citation)
#> Response [http://httpbin.org/post]
#> Date: 2022-05-04 12:21
#> Status: 200
#> Content-Type: application/json
#> Size: 1.55 kB
#> {
#> "args": {},
#> "data": "bibentry(\"Manual\",\n title = \"R: A Language and E...
#> "files": {},
#> "form": {},
#> "headers": {
#> "Accept": "application/json, text/xml, application/xml, */*",
#> "Accept-Encoding": "deflate, gzip, br",
#> "Content-Length": "956",
#> "Content-Type": "text/plain",
#> ...
POST("http://httpbin.org/post", body = list(y = citation))
#> Response [http://httpbin.org/post]
#> Date: 2022-05-04 12:21
#> Status: 200
#> Content-Type: application/json
#> Size: 1.63 kB
#> {
#> "args": {},
#> "data": "",
#> "files": {
#> "y": "bibentry(\"Manual\",\n title = \"R: A Language and En...
#> },
#> "form": {},
#> "headers": {
#> "Accept": "application/json, text/xml, application/xml, */*",
#> "Accept-Encoding": "deflate, gzip, br",
#> ...