]]--
module("ffluci.sgi.haserl", package.seeall)
+require("ffluci.fs")
-- Environment Table
ffluci.http.env = ENV
print()
end
+-- Returns the path of an uploaded file
+-- WARNING! File uploads can be easily spoofed! Do additional sanity checks!
+function ffluci.http.upload(name)
+ local fpath = ffluci.http.formvalue(name)
+ local fname = ffluci.http.formvalue(name .. "_name")
+
+ if fpath and fname and ffluci.fs.isfile(fpath) then
+ return fpath
+ end
+end
+
-- Sets HTTP-Status-Header
function ffluci.http.status(code, message)
print("Status: " .. tostring(code) .. " " .. message)
print()
end
+-- Returns the path of an uploaded file
+-- WARNING! File uploads can be easily spoofed! Do additional sanity checks!
+function ffluci.http.upload(name)
+ -- To be implemented
+end
+
-- Sets HTTP-Status-Header
function ffluci.http.status(code, message)
print(webuci.env.SERVER_PROTOCOL .. " " .. tostring(code) .. " " .. message)
local ret = nil
local plat = ffluci.fs.mtime("/lib/upgrade/platform.sh")
- local image = ffluci.http.formvalue("image")
- local imgname = ffluci.http.formvalue("image_name")
+ local image = ffluci.http.upload("image")
local keepcfg = ffluci.http.formvalue("keepcfg")
- if plat and imgname then
+ if plat and image then
local kpattern = nil
if keepcfg then
local files = ffluci.model.uci.sections("luci").flash_keep