Validate Image path and name
function validate()
{
var pobject = document.getElementById("path");
alert(pobject.value);
var doc_array = pobject.value.split("//");
if(doc_array.length==1) {
alert('Please enter the complete path'); return false; }
var doc_array1 = (doc_array[doc_array.length-1]).split(".");
if (doc_array1[doc_array1.length-1] != '') {
if((doc_array1[doc_array1.length-1].toUpperCase()!="GIF")&& (doc_array1[doc_array1.length-1].toUpperCase()!="JPEG")&& (doc_array1[doc_array1.length-1].toUpperCase()!="BMP")&& (doc_array1[doc_array1.length-1].toUpperCase() != "JPG")) {
alert("Only .GIF, .JPEG, .BMP, .JPG files can be uploaded"); return false;
}
else {
return true;
}
}
else {
alert("Invalid File"); return false;
}
}