[luci] LuCI Web Interface for Upload/Download of files

Seamus Tuohy s2e at opentechinitiative.org
Mon Jun 25 20:56:30 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I have been working on porting the Pirate Box project to OpenWRT. I am
using the LuCI interface instead of the existing Python based web
interface "Droopy." I have been working with existing chunks of code
and modifying them for my purposes. I have been unsuccessful finding
these answers in the existing documentation and list-serv archives.

To handle uploading I have been using code taken from flashops.htm and
system.lua which handles uploading new images to the router. I am
using luci.http.setfilehandler with function(meta,chunk,eof) to direct
an uploaded file through io.open (FILE_NAME, "w").

Knowing that meta.name is the "name" element of a submitted form. Is
there an equivalent object for the name of the uploaded file? I have
looked over the luci.lua code that defines the handler function and
cannot seem to parse it out from there. I would like to use the file
name to define the FILE_NAME variable.

I am using the filebrowser.htm view to allow a user to browse the
directory where files are uploaded. I am having difficulty sending a
href back to the Lua (luci.ltn12.pump.all) controller code to allow a
user to download the file. I can't seem to find the correct way to
send the location from the clicked link to the lua backend to initiate
the download.

My last question is about the luci.ltn12.pump.all function. If I do
have a path to a file on a router (or attached USB drive) can I simple
use that path as the source and luci.http.write as the sink to send a
file to a user?

Thanks, I would appreciate any answers or links to resources I may
have missed.

Seamus Tuohy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJP6LReAAoJEKG7t1KxMTwvetoH/3enyeZLE+clcE8ZTn0x2DBF
OfGBSmxXapz0crRSSUQKVvAIPRVeibz5fml5KVZDOHT0KC97u+FHH+jmm75qrWE9
rwAiyCRMJADPSM0Jnb7FMrlBBykx4k5HwxcMGL6Iw42fCAOEwzQjNj+kFIYKgEoc
ifKWDWflmIFgbOURQBdTvl3UOun5Lt8XYFiroD5xNPvA9gPsjG354Z4QdbKYm4yj
95hbeYqu8YHjQfOyVpuuL+SQ2XJtyJloyhQn1Xi8cQfxVV1UneQkxr+jEVGG6a25
j58cPNJsdfx//cw/QsObZ/jJKJYKI+rxxjsZpQxm7hufYnuZPhm6HbR4s9GBd34=
=ARa5
-----END PGP SIGNATURE-----


More information about the luci mailing list