Tutorial :html form enctype



Question:

In HTML forms containg file uploads, enctype="multipart/form-data" attribute has to be set. This much I know. But why? What exactly does it change? How does it differ from application/x-www-form-urlencoded?


Solution:1

Here's the W3C doc on both items. It's pretty dry but it can help some.


Solution:2

The default encoding of appliaction/x-www-form-urlencoded can't send a) large quantities or binary data or b) text containing non-ASCII characters. That's why you need to set it to multipart/form-data for file uploads.


Solution:3

A multipart request can have multiple parts (sic). Thus you can send files in the HTTP request along with the rest of the request.

Multipart can also be found in emails with attatchments.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »