some questions about the upload module

Valery Kholodkov valery+nginxen at
Tue Sep 9 23:10:37 MSD 2008

"Manlio Perillo" <manlio_perillo at> 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

Second, POST has side effects and GET hasn't, thus they are incompatible
at this point.

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

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

> Using multipart/form-data, I would instead return
> --AaB03x
> Content-Disposition: form-data; name="submit-name"
> Larry
> --AaB03x
> Content-Disposition: form-data; name="files_name"; filename="file1.txt";
>    path=<path_temporary_file>
> --AaB03x--

I'm not sure an arbitrary framework can process "path" parameter and
moreover one would treat this field as file field, since filename is

Best regards,
Valery Kholodkov

More information about the nginx mailing list