I want to upload files to my server using the following html and js:
<script type="text/javascript">
$(function() {
$('#uploadimageBtn').click(function() {
$('#imageInput').click();
});
$('#imageInput').change(function(event) {
$('#loading-spinner').show();
var file = $(this).val();
var fileName = file.split("\\");
$('#uploadimageBtn-inner').html("Uploading...");
$('#uploadForm').submit();
event.preventDefault();
});
});
</script>
<div id="uploadimageBtn">
<g:img id="loading-spinner" style="display:none;" file="loading.gif"/>
<div id="uploadimageBtn-inner">Click to upload a file</div>
</div>
<g:form name="uploadForm" action="update" method="post" enctype="multipart/form-data">
<div style="height: 0px;width: 0px; overflow:hidden;">
<input id="imageInput" name="image" type="file" value="upload"/>
</div>
</g:form>
It works perfect in all the major browsers but in IE it did not work.
So what do I have to change in order to make it work?