diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-23 13:30:07 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-23 13:30:07 +0000 |
commit | c0b2cda50edbe5bd39e47f776b2bc73e3d175bc4 (patch) | |
tree | 83054a28d952b42353239624c8b1fa8f24453fbc /libs/web | |
parent | 251502e2cd0c47b426cfd4d4f183128ca528b91b (diff) |
* luci/libs: move upload dispatching from dispatcher to cbi.load()
Diffstat (limited to 'libs/web')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 0665ce42b..236bc9c15 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -466,63 +466,6 @@ function cbi(model) maps = luci.cbi.load(model, ...) - local uploads = { } - local has_upload = false - - for _, map in ipairs(maps) do - if map.upload_fields then - has_upload = true - for _, field in ipairs(map.upload_fields) do - uploads[ - field.config .. '.' .. - field.section.sectiontype .. '.' .. - field.option - ] = true - end - end - end - - if has_upload then - local uci = luci.model.uci.cursor() - local prm = luci.http.context.request.message.params - local fd, cbid - - luci.http.setfilehandler( - function( field, chunk, eof ) - if not field then return end - if field.name and not cbid then - local c, s, o = field.name:gmatch( - "cbid%.([^%.]+)%.([^%.]+)%.([^%.]+)" - )() - - if c and s and o then - local t = uci:get( c, s ) - if t and uploads[c.."."..t.."."..o] then - local path = "/lib/uci/upload/"..field.name - fd = io.open(path, "w") - if fd then - cbid = field.name - prm[cbid] = path - -- else - -- io.stderr:write("E: " .. err .. "\n") - end - end - end - end - - if field.name == cbid and fd then - fd:write(chunk) - end - - if eof and fd then - fd:close() - fd = nil - cbid = nil - end - end - ) - end - for i, res in ipairs(maps) do res:parse() end |