Rumah > Artikel > hujung hadapan web > HTML相关知识和经验的碎片化记录 - yuzhihui
1、标签input在type="file"时,name是必须属性
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><span style="color: #800000;">form </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">MainFileUpload" name</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">MainFileUpload" enctype</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">multipart/form-data"</span><span style="color: #0000ff;">></span> <span style="color: #008080;">2</span> <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">cls_MainFileUpload"</span><span style="color: #0000ff;">></span> <span style="color: #008080;">3</span> <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">cls_MainFileUpload2"</span><span style="color: #0000ff;">></span> <span style="color: #008080;">4</span> <span style="color: #0000ff;"><span style="color: #800000;">img </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">MainFileUploadBtnImg" class</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">cls_MainFileUploadBtnImg" alt</span><span style="color: #0000ff;">=""</span><span style="color: #ff0000;"> src</span><span style="color: #0000ff;">=""</span> <span style="color: #0000ff;">/></span> <span style="color: #0000ff;"><span style="color: #800000;">input </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">cls_FileUpload" type</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">file"" id</span><span style="color: #0000ff;">="</span><span style="color: #ff0000;">{0}_FileUpload" name</span><span style="color: #0000ff;">="FileUpload"</span><span style="color: #0000ff;">/></span> <span style="color: #008080;">5</span> <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span> <span style="color: #008080;">6</span> <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span> <span style="color: #008080;">7</span> <span style="color: #0000ff;"></span><span style="color: #800000;">form</span><span style="color: #0000ff;">></span></span></span></span></span></span>
<span style="font-size: 14px;">标签input在type="file"时,name是必须属性,如果没有name属性,那么在表单提交时,文件不能被提交(即上传)</span><br><span style="font-size: 14px;">......</span>