報錯時的使用:測試
@Html.TextBoxFor(m => m.FileName, new { style = "width:457px;", @readonly = "readonly" }) <button class="btn" type="button" onclick="$('#attachFile').click()"><span class="fa fa-folder"></span>選擇</button> <input id="attachFile" onchange="attachFileChange()" type="file" name="attachFile" style="display:none;" />
修改後的使用:spa
@Html.TextBoxFor(m => m.FileName, new { style = "width:457px;", @readonly = "readonly" })
<button class="btn" style="" type="button"><span class="fa fa-folder"></span>選擇</button>
<input id="attachFile" style="position:absolute;left:0px;top:0;width:520px;height:100%;z-index:999;opacity:0;filter:alpha(opacity=0);-moz-opacity:0;-kh tml-opacity:0;" onchange="attachFileChange();" type="file" name="attachFile" />code
修改後測試經過blog