Difference between application/x-www-form-urlencoded and multipart/form-data in HTTP/HTML?
Recently in one of the Java web developer interview, one of my readers asked about the difference between x-www-form-url-encoded and multipart/form-data MIME types. In HTTP, there are two ways to send the HTML form data to the server either by using ContentType application/x-www-form-urlencoded or by using multipart/form-data. Even though both can be used to send both text and binary data to the server there is a subtle difference between them. In the case of x-www-form-urlencoded, the whole form data is sent as a long query string. The query string contains name-value pairs separated by & character e.g. field1=value1&field2=value2 etc. It is similar to URL encoding and normal GET request where data is sent on URL, but form data goes inside POST request body and they are encoded like that. Also, both reserved and non-alphanumeric characters are replaced by '%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character e.g. space is repla...