use uuid to generate filename (#7)

This commit is contained in:
木逸辰
2021-09-02 12:40:51 +08:00
committed by GitHub
parent b1996fb87a
commit 8737bc30e1
+2 -2
View File
@@ -7,7 +7,7 @@ local cjson = require "cjson"
local chunk_size = 4096
local form = upload:new(chunk_size)
-- local sha1 = resty_sha1:new()
uuid.seed()
ngx.say("...FILE UPLOAD...")
local file
@@ -21,7 +21,7 @@ while true do
if typ == "header" then
-- local file_name = my_get_file_name(res)
local file_name = "/tmp/foo.jpeg" -- todo moicen: use uuid() to generate file name.
local file_name = string.format("/tmp/%s.jpeg", uuid())
ngx.say("...CREATE FILE....")
if file_name then
file = io.open(file_name, "w+")