<script language="javascript" type="text/javascript">
function validate() {
var result = false;
var upfile = document.getElementById("FileUpload1").value;
if (upfile != "") {
var accept = "png,gif,jpg,jpeg".split(',');
var getExtention = upfile.split('.');
var extention = getExtention[getExtention.length - 1];
for (i = 0; i < accept.length; i++) {
if (accept[i] == extention) {
result = true;
break;
}
}
if (!result) {
alert(" Only Allowed here file extention are png,gif,jpg,jpeg");
}
}
else {
alert("please select image to Upload");
}
return result;
}
</script>
<asp:button id="btnUploadImage" onclick="btnUploadImage_Click"
onclientclick="return validate();" runat="server"
text="Upload to DataBase">
No comments:
Post a Comment