上传文件的插件
代码如下:
function index()
entry({"firefly-api", "upload_pic"}, call("upload_pic")).dependent=false
end
function upload_pic()
local path = "/tmp/abc.png"
local log = "1"
local fp
luci.http.setfilehandler(
function(meta, chunk, eof)
log = "2"
if not fp then
fp = io.open(path, "w")
end
if chunk then
fp:write(chunk)
end
if eof then
fp:close()
end
end
)
luci.http.write(log)
end
但是无论如何都不进入luci.http.setfilehandler |