args = ngx.req.get_uri_args()
--body_data不一定是普通的字符串,这与请求的content-type有关,如multipart/form-datalocal body_data = ngx.req.get_body_data()if not body_data thenlocal datafile = ngx.req.get_body_file()ngx.log(ngx.ERR, "body is in file: ", tostring(datafile))if datafile thenlocal fh, err = io.open(datafile, "r")if fh thenfh:seek("set")body_data = fh:read("*a")fh:close()if body_data == "" thenngx.log(ngx.ERR, "request body is empty")endendendend
--TNekoE5fCH9MSS3bDHD3cH42OnotPYFContent-Disposition: form-data; name="_data_"Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bit{"fileName":"redis-use.png","bizCode":"1071"}--TNekoE5fCH9MSS3bDHD3cH42OnotPYFContent-Disposition: form-data; name="file"; filename="deaultFilename"Content-Type: application/octet-streamContent-Transfer-Encoding: binary...省略略内容TNekoE5fCH9MSS3bDHD3cH42OnotPYF--
文章转载自编程阁楼,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




