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
while true do
local typ, res, err = form:read()
if not typ then
ngx.say("failed to read: ", err)
return
end
if typ == "header" then
local key = res[1]
local value = res[2]
if key == "Content-Disposition" then
local kvlist = string.split(value, ';')
for _, kv in ipairs(kvlist) do
local seg = string.trim(kv)
if seg:find("filename") then
local kvfile = string.split(seg, "=")
local filename = string.sub(kvfile[2], 2, -2)
if filename then
ext = getExtension(filename)
local now = os.date("%Y%m%d%H%M%S", os.time())
local filename = now.."-"..string.sub(ngx.md5(now..user_cid), 0, 8)..ext
local image_id = ""
if string.find(uri, "/upload/photo") then
uri = string.gsub(ngx.var.uri, '/upload/photo', "/bfs/g/"..filename)
image_id = "/g/"..filename
elseif string.find(uri, "/upload/voice") then
uri = string.gsub(ngx.var.uri, '/upload/voice', "/bfs/v/"..filename)
else
ngx.print(cjson.encode({code=404, message="Not Found"}))
ngx.exit(404)
end
break
end
end
end
end
--append body
elseif typ == "body" then
if res then
appender = appender..res
end
--one file has been read
elseif typ == "part_end" then
if appender ~= '' then
-- If the uploaded file is a picture,I want it to be a 2048 by 2048 image with maximum height and width
code = upload2BFS(uri, data)
The text was updated successfully, but these errors were encountered:
Maybrittnelson
changed the title
How do I compress the data in the body
If the uploaded file is a picture,I want it to be a 2048 by 2048 image with maximum height and width
May 7, 2019
The text was updated successfully, but these errors were encountered: