function ValidateFileUpload(ControlID, filename) {
var
isValid = false;
var
Extension = filename.substring(filename.lastIndexOf('.')
+ 1).toLowerCase();
var
extArray = new Array("gif",
"jpg", "tif",
"jpeg", "tiff",
"pdf", "txt",
"doc", "docx",
"rtf");
for
(var i = 0; i < extArray.length; i++) {
if
(extArray[i] == Extension) {
isValid = true;
break;
}
}
if
(isValid == false) {
document.getElementById(ControlID).value = "";
alert('
<%=ViewRes.Common.Invalidfileformat%>');
}
}
<input class="txtfld FileUpload"
onchange="ValidateFileUpload(this.id,this.value)"
type="file" id="file1"
name="AttributeImages1" />
No comments:
Post a Comment