I create a HTML and jQuery code to submit a form with jQuery and it works in all browsers except Internet Explorer.
HTML:
<form name="file_upload" id="file_upload" action="<?php echo base_url(); ?>projects/file" enctype="multipart/form-data" method="POST">
<a class="button" onclick="document.getElementById('file-upload-input').click(); return false;"><span class="plus"></span>Upload File</a>
<input id="file-upload-input" name="upload" type="file" style="display:none;">
<input id="submit-button" name="submit" type="submit" value="Upload" style="display:none;">
</form>
jQuery
$(document)
.on('change', '#file-upload-input', function(){
$('#submit-button').click();
})
EDIT: I have also tried :
$(document)
.on('change', '#file-upload-input', function(){
$("#file_upload").submit();
})
But the input submit didn't submit a form only in Internet Explorer.