i have this user control it works well
but when i drag it twice on same page it mixes up the images upload with one and another
pls advice
<%@ control language="C#" autoeventwireup="true" codebehind="Image_uploadasync_uc.ascx.cs"
inherits="VendorPanel.usercontrol.Image_uploadasync_uc" %>
<div class="white-bg shadow">
<h4 class="padding15 no-margin">
Product Cover Image
</h4>
<hr class="no-margin" />
<br />
<label class="file-upload">
<span class="border radius padding15">Select Image</span>
<asp:FileUpload ID="fubanner" runat="server" />
</label>
<span class="pull-right">
<asp:Image ID="imgbanner" runat="server" Width="100px" /></span>
<br />
<br />
<br />
</div>
<script language="javascript" type="text/javascript">
$(function () {
$('[id*=fubanner]').change(function () {
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) {
$('[id*=imgbanner]').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>
<uc1:Image_uploadasync_uc runat="server" ID="Image_uploadasync_uc" />
<uc1:Image_uploadasync_uc runat="server" ID="Image_uploadasync_uc1" />