1.enctype 是提交數(shù)據(jù)時(shí)定義的編碼類型。enctype="multipart/form-data"
規(guī)定提交數(shù)據(jù)時(shí)不對(duì)字符編碼。一般表單中有文件類型數(shù)據(jù)上傳時(shí)使用。
上傳文件我們需要加那個(gè)屬性在form表單。
form表單中的file上傳
<input type="file" name="img1">
取得img:
img1 = request.FILES.get('img1')
2.表單總共有13種控件。
http://www.cnblogs.com/xiaohuochai/p/5180638.html
表單控件:
# 最為復(fù)雜和龐大
<input>
# 傳統(tǒng)
<button>
<select>
<option>
<label>
<optgroup>
<textarea>
<fieldset>
<legend>
# 新增
<datalist>
<progress>
<meter>
<output>
<keygen>
<label>
一般都有一個(gè)屬性 for="某個(gè)表單控件的id"
。
<select>
控件位于<form></form>
之外,但是也屬于表單一部分。
詳解:http://www.w3school.com.cn/tags/att_select_form.asp
注意:
如果<option>A</option>
沒有設(shè)置value,那么默認(rèn)就是這里面的A
。