tags:

views:

788

answers:

3

I found out that HTML form supports only two enctype tyeps. They are application/x-www-form-urlencoded and multipart/form-data. I understand that I use multipart/form-data when I need to upload a file. When do I use application/x-www-form-urlencoded? Is it default form enctype?

+1  A: 

Yes, it is. Here's a cite from the W3 HTML forms specification:

The default value for this attribute is "application/x-www-form-urlencoded". The value "multipart/form-data" should be used in combination with the INPUT element, type="file".

The webbrowser will take care about URL encoding automatically.

BalusC
+1  A: 

Yes, the default enctype is application/x-www-form-urlencoded.

Seth
+1  A: 

application/x-www-form-urlencoded

This is the default content type. Forms submitted with this content type must be encoded as follows:

1) Control names and values are escaped. Space characters are replaced by '+', and then reserved characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by '%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').

2) The control names/values are listed in the order they appear in the document. The name is separated from the value by '=' and name/value pairs are separated from each other by `&'.

Check out this link for more on form content types, or here for more information about file uploads and such.

injekt