some questions about the upload module

Manlio Perillo manlio_perillo at libero.it
Tue Sep 9 23:46:55 MSD 2008


Valery Kholodkov ha scritto:
> "Manlio Perillo" <manlio_perillo at libero.it> wrote:
> 
>> Then I'm not sure to understand.
>> What's the benefit of using multipart/form-data if data is encoded in
>> this way?
>>
>> Isn't it better to use application/x-www-form-urlencoded?
>>
>> submit-name=Larry&files_name=file1.txt&files_type=text/plain&files_path=<path_temporary_file
>>
>>
>> Note that this was the original idea I had in mind to implement.
> 
> It depends. First, if you have simple form with one file field it might be
> more efficient to use application/x-www-form-urlencoded. But generally you
> may have something like a text area for an Email body and this information
> hardly fits into request URI and most frameworks are likely not to be
> compatible with request URIs of unlimited size and this could be
> troublesome.
> 
> Second, POST has side effects and GET hasn't, thus they are incompatible
> at this point.
> 

Note that I have never written that POST should be changed to GET.

> Third, for application/x-www-form-urlencoded I have to do URL encoding.
> 

This is a good point.
But Nginx has already support for the encoding.

> All these things are arguments against application/x-www-form-urlencoded
> from my point of view, thus I use multipart/form-data.
> 

IMHO it is an overhead, but fine.
I will implement a WSGI middleware that will transform a POST 
multipart/form-data in a POST with application/x-www-form-urlencoded.


 > [...]


Thanks   Manlio Perillo





More information about the nginx mailing list