Files
resty_functions/scripts/test_upyun_upload.lua
T

27 lines
657 B
Lua
Raw Normal View History

2022-01-15 18:40:22 +08:00
local yun = require("upyun")
2022-01-15 21:32:55 +08:00
local function upyun_upload_file()
2022-01-15 18:40:22 +08:00
2022-01-15 21:32:55 +08:00
local config = {
user = "moicen", --授权操作员名称
passwd = "NyJ51zRwFApY9Wo9EHJMrb8GI9YtvpVN", --操作员密码
localFilePath = "/Users/liyong/Code/Lua/resty_functions/test_files_dir/r2d2.jpeg"
}
2022-01-15 18:40:22 +08:00
2022-01-15 21:32:55 +08:00
local upyun = yun:new(config)
local savePath = "huiwing/test/r2d2.jpeg"
local gmkerl = nil
local options = nil
local info, err = upyun:upload_file(savePath, gmkerl, options)
if not info then
ngx.say("failed to upload image file : " .. err)
return
else
ngx.say(info)
end
2022-01-15 18:40:22 +08:00
end
2022-01-15 21:32:55 +08:00
upyun_upload_file()