The front desk call is as follows
The code copy is as follows: OnClientClick="return fucCheckJpgAndGif(form1.File1.value);" -- where File1 is the upload file control
Function code:
The code copy is as follows:
function fucCheckJpgAndGif(strFileName) {
if (strFileName != "") {
var strtype = strFileName.substring(strFileName.length - 4, strFileName.length);
strtype = strtype.toLowerCase();
if ((strtype == ".jpg") || (strtype == ".gif") || (strtype == "jpeg") || (strtype == ".bmp")) {
return true;
}
else {
alert("Please upload images in jpg, gif or bmp format, thank you!");
return false;
}
}
alert("Please upload images in jpg, gif or bmp format, thank you!");/* from http://yige.org/js/ */
return false;
}