From 8737bc30e19cf66ffe6f27053149e024584ee09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E9=80=B8=E8=BE=B0?= Date: Thu, 2 Sep 2021 12:40:51 +0800 Subject: [PATCH] use uuid to generate filename (#7) --- prod/upload/upload.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prod/upload/upload.lua b/prod/upload/upload.lua index 470f74e..fb13ead 100644 --- a/prod/upload/upload.lua +++ b/prod/upload/upload.lua @@ -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+")