Welcome! Log In Create A New Profile

Advanced

Re: extend the upload module

Francis Daly
April 23, 2012 02:14PM
On Mon, Apr 23, 2012 at 09:52:04AM -0400, JCR wrote:

Hi there,

> I am using the /nginx_upload_module-2.2.0 with nginx 1.0.15
> with great success
>
> I would like to extend it in two ways:

I suspect that these extensions would be out of scope for this module,
which seems to be more about making it easier to write your own form
handler.

That said, I'm sure no-one's going to stop you from coding.

> (1)
> Each HTTP POST request to the module contains a username and a password
> field and I would like to make some checks on those values as early as
> possible and possibly reject the request even before the file is
> uploaded.

If you used http basic authentication, the effect of this could come
for free. But you don't.

Fundamentally, what you seem to want is for the handler to read a part
of the POST request body and then decide whether to respond and close
the connection, or accept the rest of the request body.

I'm not sure how you'd go about that.

> (2)
> I would like to save the file in a directory which depends on the file
> name and using the original file name instead of the current 10-digit
> 000... filename

That one is probably better handled in your own form handler -- you can
be given the original suggested filename and the 10-digit filename, and
do a "mv" of one to the other, handling duplicates and evil filenames as
you see fit. No need to hard-code the handling within the module.

You probably will want to make sure that "upload_store" is on the same
filesystem as you wish the files to end up on.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

extend the upload module

JCR April 23, 2012 09:52AM

Re: extend the upload module

Francis Daly April 23, 2012 02:14PM

Re: extend the upload module

Alexandr Gomoliako April 23, 2012 02:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 255
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready