nginx 1.4.x file upload multipart ecoded

Yichun Zhang (agentzh) agentzh at gmail.com
Fri Jul 26 18:38:42 UTC 2013


Hello!

On Fri, Jul 26, 2013 at 5:06 AM, David J wrote:
> I was looking at resty upload module. I was curious how to store the file on
> disk relative to the document root?
>
> For some reason it didn't work unless I specified the absolute path.
>

You can just obtain the document root in Lua via
ngx.var.document_root, i.e., accessing Nginx's built-in variable
$document_root:

    http://wiki.nginx.org/HttpCoreModule#.24document_root

So it's trivial to construct a proper absolute path without assuming
what the document root is in Lua.

Regards,
-agentzh



More information about the nginx mailing list