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
server {
location/ {
content_by_lua_block {
local upload = require "upload"local form, err = upload:new(4096)
if not form then
ngx.say(err)
ngx.exit(200)
end
form:set_timeout(1000)
file = io.open('/tmp/upload.tmp', "w+")
while true do
local typ, res, err = form:read()
if not typ then
ngx.say(err)
return
end
if typ == "body" then
file:write(res)
end
if typ == "eof" then
break
end
end
ngx.say("file uploaded")
}
}
}
content_by_lua_block - lib:nginx-lua module directive to specify block of Lua code