我发现 HTML 表单只支持两种 enctype 类型。它们是 application/x-www-form-urlencoded
和 multipart/form-data
。我知道我在需要上传文件时使用 multipart/form-data
。什么时候使用 application/x-www-form-urlencoded
?它是默认形式 enctype 吗?
最佳答案
是的,是的。这是来自 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 theINPUT
element,type="file"
.
网络浏览器将关注 URL encoding自动。
关于html - application/x-www-form-urlencoded 是 html 表单的默认值吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2436716/