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
ngx.ctx.uploads={} --m.getupload()
ngx.req.read_body()
ngx.ctx.posts={}
args, err = ngx.req.get_post_args()
for key, val in pairs(args) do
ngx.ctx.posts[key]=val
ngx.ctx.gets[key]=val
and m.getupload is using your library, to get all the uploads into table hashed by the input_name. it also save the non file data input to table posts
getupload:->
form = upload\new(100000)
file_name=""
input_name=""
resx=""
result={}
while form~=nil do
typ, res, err = form\read()
if typ == "header" then
if res[1]=="Content-Disposition"
tt=m.getfield(res)
file_name = tt.filename
input_name = tt.name
resx=""
elseif typ == "eof"
break
elseif typ == "body"
if input_name
resx=resx..res
elseif typ == "part_ "
if file_name
result[input_name]={file_name,resx}
ngx.ctx.gets[input_name]=file_name
else
ngx.ctx.gets[input_name]=resx
resx=""
if i enable uploads processing then the ngx.req.get_post_args() not work. perhaps i need to detect the enc-type multipart ?
The text was updated successfully, but these errors were encountered:
@ryannining Yes, you need to test the MIME type before taking any action. lua-resty-upload implements its own request body reader while ngx.req.read_body() uses nginx's request body reader.
@ryannining You can just try calling resty.upload's new() method first. Which performs the MIME test. If the test fails, new() returns nil with an error string.
Under the hood, it just checks the Content-Type request header.
I have some code like this
and m.getupload is using your library, to get all the uploads into table hashed by the input_name. it also save the non file data input to table
posts
if i enable uploads processing then the ngx.req.get_post_args() not work. perhaps i need to detect the enc-type multipart ?
The text was updated successfully, but these errors were encountered: