- 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 config.on_valid_to and state and state > 0 and state < 2 then
+ luci.http.redirect(config.on_valid_to)
+ return
+ end