upload module 2.0.4
manlio_perillo at libero.it
Thu Aug 7 10:36:46 MSD 2008
mike ha scritto:
> On 8/6/08, Valery Kholodkov <valery+nginxen at grid.net.ru> wrote:
> Hi there - how could this work with PUT method?
You don't need this module, if the request body contains the whole file.
The upload module is usually useful for POST requests, since the request
body is multipart/form-data encoded, when sent by browsers.
If you are using PUT, then probably the client is under your control.
> Basically I need to be able to PUT files of various sizes - from a few
> bytes to 2GB, maybe more someday.
> We'd like the webserver to accept it via PUT and then feed the
> location of the file to PHP so PHP can do the post processing (file
> rename, input the metadata into database, etc.)
> I want to use nginx for this. Not sure if a third party module like
> yours is required or not. Right now, I can do a simple single file PUT
> to a php script and use php://input to open the stream. However large
> files will consume all the PHP script resources I believe if it has to
> accept all the data (unless the upload client is smart enough to spoon
> feed it in certain chunks...)
This is not what the upload module does: the upload module has been
written for decoding multipart/form-data request bodies "on the fly".
If the file is very large, there is nothing that can be done now.
How do you read the file from PHP?
If you don't have to read the whole file (as it usually is), then this
should not be a big problem.
As an example, for renaming the file, you don't need to read the file
from PHP: let Nginx store the file in a temporary file and just rename
> Is this understandable? I've kind of gone off the deep end here now.
More information about the nginx