summaryrefslogtreecommitdiffhomepage
path: root/applications/sgi-haserl
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-13 09:21:10 +0000
committerSteven Barth <steven@midlink.org>2008-05-13 09:21:10 +0000
commitb481ea4934cd3c28a9dd7719e5993fc9c21b0249 (patch)
treed1f198e9cce3d75e9d840c8357a0fe1a909ca157 /applications/sgi-haserl
parentb5243ea95fb92260eba14288fc5acc14e63a2d81 (diff)
* applications/sgi-haserl: Added ffluci.http.upload for file uploads
* applications/sgi-webuci: Added stub for ffluci.http.upload
Diffstat (limited to 'applications/sgi-haserl')
-rw-r--r--applications/sgi-haserl/src/sgi/haserl.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/applications/sgi-haserl/src/sgi/haserl.lua b/applications/sgi-haserl/src/sgi/haserl.lua
index 027697e2e4..0e388391db 100644
--- a/applications/sgi-haserl/src/sgi/haserl.lua
+++ b/applications/sgi-haserl/src/sgi/haserl.lua
@@ -24,6 +24,7 @@ limitations under the License.
]]--
module("ffluci.sgi.haserl", package.seeall)
+require("ffluci.fs")
-- Environment Table
ffluci.http.env = ENV
@@ -70,6 +71,17 @@ function ffluci.http.redirect(url)
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)