[luci] File upload size limit?

Lay András andras at lay.hu
Tue Dec 11 15:46:02 CET 2012


Hello!

I'm using the following code to accept file uploads (the file input
name in html is 'adat'):

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

It works fine with small files, but if the files larger than ~10kb, it
drops error:

/usr/lib/lua/luci/dispatcher.lua:448: Failed to execute call
dispatcher target for entry '/upload/upload'.
The called action terminated with an exception:
/usr/lib/lua/luci/http/protocol.lua:452: attempt to call upvalue
'store' (a nil value)
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:195: in function
</usr/lib/lua/luci/dispatcher.lua:194>

What i doing wrong?


More information about the luci mailing list