Reputation: 37002
I have following html form:
<form method="POST" action="uploadImage" enctype="multipart/form-data">
<input type="file" class="file" name="file"/>
<input type="submit" value="Upload">
</form>
I see two things on page
1 - file selector
2 - upload button
I want to avoid submit button and form should be submitted right after file was selected.
Can you help me?
Upvotes: 2
Views: 293
Reputation: 4896
with javascript..
<form method="POST" name="myform" action="uploadImage" enctype="multipart/form-data">
<input type="file" class="file" name="file" onchange="document.forms['myform'].submit();"/>
</form>
Upvotes: 1
Reputation: 1325
Maybe this helps you:
$('.file').change(function(){
$('form').submit();
});
Upvotes: 5