当前位置: 代码迷 >> ASP.NET >> 表单下传有关问题
  详细解决方案

表单下传有关问题

热度:2729   发布时间:2013-02-25 00:00:00.0
表单上传问题
HTML code
<iframe name="ajaxifr" style="display:none;"></iframe><form name="upload" id="upload" method="post"  enctype="multipart/form-data"   action="../../Handler/a.ashx" target="ajaxifr" ><input type="file" id="fileupload"  onpropertychange="document.forms[0].submit();"  /><input   type="button" value="改变头像\" onclick="$('fileupload').click();" /></form>


单独点file可以触发submit, 但是想通过一个button触发file 的onclick事件,然后选中文件后触发 submit 就失败。

------解决方案--------------------------------------------------------
参考:
http://blog.csdn.net/foren_whb/article/details/6307828
------解决方案--------------------------------------------------------
<input type="file" id="fileupload" onpropertychange="document.forms[0].submit();" />
<input type="button" value="改变头像\" onclick="$('fileupload').click();" />

=》
<input type="file" id="fileupload" />
<input type="button" value="改变头像\" onclick="document.forms[0].submit();" />
  相关解决方案