[luci] luci.http.setfilehandler function not called

Federico Fissore federico at fissore.org
Thu May 23 18:28:15 CEST 2013


Hi everyone

I'm trying to handle a file upload with function

function upload()
   local fp
   luci.http.setfilehandler(function(meta, chunk, eof)
     if not fp and meta and meta.name == "image" then
       local filename = luci.http.formvalue("sketch")
       fp = io.open("/tmp/" .. filename, "w")
     end
     if fp then
       if chunk then
         fp:write(chunk)
       end
       if eof then
         fp:close()
       end
     end
   end)
end

configured with

entry({ "image", "upload" }, call("upload"), _("My Web Panel"), 10)

Problem is that that function is not called at all

I'm using luci branch 0.11 from
http://svn.luci.subsignal.org/luci/branches/luci-0.11

Any hints? I'm quite stuck... :(


More information about the luci mailing list