+ local tmpfile = "/tmp/firmware.img"
+
+ local file
+ luci.http.setfilehandler(
+ function(meta, chunk, eof)
+ if not file then
+ file = io.open(tmpfile, "w")
+ end
+ if chunk then
+ file:write(chunk)
+ end
+ if eof then
+ file:close()
+ end
+ end
+ )
+
+ local fname = luci.http.formvalue("image")