[luci] Please help with FileUpload

Vasily Olekhov olekhov at gmail.com
Wed Oct 24 07:33:48 CEST 2012


Greetings. I am porting OpenWrt to new platform and need to make some
interface adjustments.
The documentation for CBI api is incomplete, e.g. it does not cover
FileUpload option.

I have tried to make it just like in model/cbi/openvpn-basic.lua script,
with no luck.

Consider these scripts:

controller/uploadtest.lua:
module("luci.controller.uploadtest", package.seeall)
function index()
    entry({"admin", "uploadtest"}, cbi("uploadtest"), "Test UPLOAD", 25)
end

model/cbi/uploadtest.lua:
local form = Map("uploadtest", "Test UPLOAD")
local sect1 = form:section(NamedSection,"s1")
local ufile = sect1:option(FileUpload,"file1","fileup","filehint")
return form

/etc/config/uploadtest:
config 'uploadtest' 's1'
        option 'file1' 'soc_customfw.bin'

These do show the upload form.
But when I try to upload the file, it does not actually do it.
The option 'file1' is replaced with filename, but file itself is not
uploaded. Why is this - I can not guess.
Meanwhile "OpenVPN" tab is fully functional and I can upload certs with it.
/lib/uci/upload is writable and holds only OpenVPN certificates and keys.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20121024/3e061736/attachment.html>


More information about the luci mailing list