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

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

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

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:空格转换为 "+" 加号,但不对特殊字符编码。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn