admin管理员组文章数量:1188795
I want the file input will automatic upload my image without enter any submit button.
<form action="/upload/" method="post" enctype="multipart/form-data">
<input type="hidden" name="user_id" value="47" />
<input type="file" name="upload" />
</form>
Let me know the trick with jQuery
I want the file input will automatic upload my image without enter any submit button.
<form action="/upload/" method="post" enctype="multipart/form-data">
<input type="hidden" name="user_id" value="47" />
<input type="file" name="upload" />
</form>
Let me know the trick with jQuery
Share Improve this question asked Dec 18, 2010 at 3:56 BlurBlur 1,2764 gold badges12 silver badges17 bronze badges2 Answers
Reset to default 18You can submit the form on the file input's onchange event, like this:
$("input[name=upload]").change(function() {
$(this).closest("form").submit();
});
With more recent versions you can also just set the autoUpload option to true:
$('#fileupload').fileupload({ autoUpload: true });
本文标签: javascriptjQuery auto upload fileStack Overflow
版权声明:本文标题:javascript - jQuery auto upload file - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738395055a2084460.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论