i have this file upload code it works well with jpg, png, gif
i want if user upload pdf, excel or word file so in preview it shows pdf, excel or word icon since documnet preview cannot be show
please advice
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=fileUploadBanner]').change(function () {
var image = $(this).closest('DIV').find($('[id*=imgBanner]'));
if (typeof (FileReader) != "undefined") {
var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/;
$($(this)[0].files).each(function () {
var file = $(this);
if (regex.test(file[0].name.toLowerCase())) {
var reader = new FileReader();
reader.onload = function (e) {
$(image).attr("src", e.target.result).attr("style", "height:100px;width: 100px;");
}
reader.readAsDataURL(file[0]);
} else {
alert(file[0].name + " is not a valid image file.");
return false;
}
});
} else {
alert("This browser does not support HTML5 FileReader.");
}
});
});
</script>
<div class="white-bg shadow">
<label class="file-upload">
<span class="border radius padding15">Select Image</span>
<asp:FileUpload ID="fileUploadBanner" runat="server" />
</label>
<span class="pull-right">
<asp:Image ID="imgBanner" runat="server" Width="100px" /></span>
</div>