Home  >  Article  >  Web Front-end  >  html form一点基础知识,实现文件上传_html/css_WEB-ITnose

html form一点基础知识,实现文件上传_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:251082browse

form用于提交文件需要修改其entype属性。

enctype属性:规定在发送表单数据之前如何对其进行编码。

默认情况,enctype的编码格式是application/x-www-form-urlencoded,不能用于文件上传;

需要文件上传时需要将编码方式修改为:multipart/form-data

 

以下是关于enctype属性的值介绍:

application/x-www-form-urlencoded:[默认] 在发送前编码所有字符(空格转换为 "+" 加号,特殊符号转换为 ASCII HEX 值)

multipart/form-data:不对字符编码。在使用包含文件上传控件的表单时,必须使用该值。

text/plain:空格转换为 "+" 加号,但不对特殊字符编码。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn