Can I Auto-submit A File Upload?
I would like to facilitate a file upload without a submit button. I've managed to hide the file upload button but I'm not sure whether it is possible to hide the submit button and
Solution 1:
Try this:
document.getElementById("file").onchange = function() {
document.getElementById("form").submit();
};
Solution 2:
You need to listen for the change
event.
$("#upload:hidden").on('change', function(){
$('#inputForm').submit();
});
Solution 3:
Yes it can be done.Try this:
<inputid="upload" name="file"type="file" onchange="this.form.submit();"/>
Solution 4:
$(function(){
$("#upload_link").on('click', function(e){
e.preventDefault();
$("#upload:hidden").trigger('click');
});
$("#upload:hidden").on('change', function(e){
e.preventDefault();
//submit form
$('#inputForm').submit();
});
});
Solution 5:
You can submit the form using following JQuery:
$('inputForm').submit()
the full answer can be found here : jQuery auto upload file
Post a Comment for "Can I Auto-submit A File Upload?"