worker_processes 1;
error_log logs/error.log info;
events {
worker_connections 1024;
}
http {
server {
listen 8083;
location /upload {
default_type multipart/form-data;
content_by_lua_block {
local resty_md5 = require "resty.md5"
local upload = require "resty.upload"
local cjson = require "cjson"
local chunk_size = 4096
local form = upload:new(chunk_size)
if not form then
ngx.log(ngx.ERR, "failed to new upload: ", err)
ngx.exit(500)
end
local md5 = resty_md5:new()
local file
local upload_path = '/home/suman/uploads/'
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 file_name = upload_path .. ngx.time()