You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In RApache, request data for a multipart/form-data HTTP POST will be
available in the session in two files:
POST : contains posted form variables
FILES: contains posted files
I am trying to accomplish the same in Rook. However, both the output
of req$POST() and Multipart$parse(env) contain a mix of the files and
arguments.
Questions:
Is there a native way to get just the FILES, and just the arguments
from a http post request, as in rapache? Or do I need to extract these
from the POST() output?
Are Multipart$parse(env) and req$POST supposed to return the same output?
Below a modified example from the manual
library(Rook)
s <- Rhttpd$new()
s$start(quiet=TRUE)
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> <br />')
res$write('Some variables: <input type="text" name="somevar"> <br />')
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>'))
}
HTTPPOST <- req$POST();
if (length(HTTPPOST)){
newstr <- paste(capture.output(str(HTTPPOST),file=NULL),collapse='\n')
res$write(c('<pre>',newstr,'</pre>'))
}
res$finish()
}
)
s$browse('multi')
The text was updated successfully, but these errors were encountered:
In RApache, request data for a multipart/form-data HTTP POST will be
available in the session in two files:
POST : contains posted form variables
FILES: contains posted files
I am trying to accomplish the same in Rook. However, both the output
of req$POST() and Multipart$parse(env) contain a mix of the files and
arguments.
Questions:
from a http post request, as in rapache? Or do I need to extract these
from the POST() output?
Below a modified example from the manual
The text was updated successfully, but these errors were encountered: