Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is application/x-www-form-urlencoded default for html form?

I found out that HTML form supports only two enctype types. 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?

like image 534
Moon Avatar asked Mar 13 '10 00:03

Moon


People also ask

How does application X-www-form-Urlencoded work?

The application/x-www-form-urlencoded content type describes form data that is sent in a single block in the HTTP message body. Unlike the query part of the URL in a GET request, the length of the data is unrestricted.

Why do we use X-www-form-Urlencoded?

Hence, it is advised to use x-www-form-urlencoded when you have to send form data e.g. most of the web form which asks you to enter values and use multipart/form-data when you have to upload files to the server as used here.

How is Formdata encoded?

Encoding TypesBlank spaces are encoded with + symbols, unsafe characters are encoded by their hexadecimal values preceded by % symbols. All popular browsers use this encoding type for form submissions, both for URL query strings (HTTP method GET ) and HTTP request bodies (HTTP method POST ).

Is X-www-form-Urlencoded secure?

Security considerations: In isolation, an application/x-www-form-urlencoded payload poses no security risks. However, as this type is usually used as part of a form submission, all the risks that apply to HTML forms need to be considered in the context of this type.


1 Answers

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.

like image 102
BalusC Avatar answered Sep 23 '22 01:09

BalusC