nginx-lua and nginx upload module

Nginx User nginx at
Sat Nov 26 09:16:47 UTC 2011

On 26 November 2011 10:36, strawman <nginx-forum at> wrote:
> Hi all,
> I'm hoping to write an nginx-lua script which handles file uploads from
> the nginx upload module.  I can do this fine using an external backend
> and the upload_pass directive, but the lua module has no functionality
> for parsing the multipart form data that this generates.  I've also
> tried accessing the $upload_file_name, $upload_tmp_path etc. variables
> generated by the upload module directly, but I don't seem to be able to
> access these outside of the upload_set_form_field directive.
> Is there any way to get the contents of those variables into a lua
> handler in a form that can be easily parsed?

Hi There,

I hit the multipart form limitation of the ngx_lua module recently and
wrote a lua module to do the job.

Basically I combined a number of functions from various cgilua modules
and added a few of my own to create a single module.

I have attached a copy and the instructions for calling it are added
as comments at the top of the module.

It will handle both url encoded and multipart encoded forms and return
the post data as a lua key/value pairs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: form_parser_module.lua
Type: application/octet-stream
Size: 19610 bytes
Desc: not available
URL: <>

More information about the nginx mailing list