| Multipart-class | R Documentation |
Multipart and object MultipartA convenience object for parsing multipart/form-data POST payloads.
parse(env): Returns parsed POST payload as a named list. env is an environment created by Rhttpd and conforms to the Rook specification.
Rhttpd, Request, and Response.
s <- Rhttpd$new()
## Not run:
s$start(quiet=TRUE)
## End(Not run)
s$add(name="multi",
app=function(env){
req <- Request$new(env)
res <- Response$new()
res$write('<form enctype="multipart/form-data" method=POST>')
res$write('Upload a file: <input type=file name=fileUpload>')
res$write('<input type=submit></form><br>')
post <- Multipart$parse(env)
if (length(post)){
poststr <- paste(capture.output(str(post),file=NULL),collapse='\n')
res$write(c('<pre>',poststr,'</pre>'))
}
res$finish()
}
)
## Not run:
s$browse('multi') # Opens a browser window to the app.
## End(Not run)
s$remove(all=TRUE)
rm(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.