[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] LunarCGI finally supports fileuploads!
- From: Sebastien Lai <237482@...>
- Date: Wed, 28 Sep 2011 05:26:02 +0200
Hello dear readers of the Lua mailinglist,
I just wanted to let you folks know that LunarCGI
(http://github.com/beelzebub/lunarcgi) finally supports fileuploads!
A big thanks goes to the LuaCheia project, whose multipart parsing
functions I borrowed, and zash (freenode) for kindly helping me out
with parsing the data correctly.
It's almost flawless (that is, I haven't found any flaws so far, so
keep testing and reporting guys), and semantically, it differs from
PHP and Perl in terms of usability quite a bit. I find it easier to
use, that is.
The value returned from LunarCGI#paramMULTIPART(<key>) is structured
as follows (shamelessly ripped from the comments from LunarCGI.lua):
-- if a file is uploaded:
-- {
-- isfile = true;
-- name = <fieldname>;
-- filename = <filename>;
-- data = <filedata>;
-- headers = {
-- type = <contenttype>;
-- charset = <charset> or nil;
-- }
-- }
-- if a simple var is posted:
-- {
-- name = <fieldname>;
-- data = <postdata>;
-- isfile = false;
-- }
The function LunarCGI#queriesMULTIPART() returns all vars found via
multipart parsing. So far one can upload several files at once without
any problems (and I admit, i'm kind of proud of it :-P).
Of course, this would have not been possible without the help of the
very kind Lua community. So a big thanks to everyone who has helped
once again :-)
One could say that this is a big step for LunarCGI, but a small step
for web programming :-)