Mostly no one validate the image in client (ya of course we validate type of image but could not validate is that true image), here that code to validate the image is available,have true
function validate()
{
if(document.form1.thumbnailimg.value!="")
{
var nnp=/\\\/g
var img1
img1 = new Image()
val ="file:///" + (document.form1.thumbnailimg.value).replace(nnp,"/")
img1.src=val
alert (img1.src)
alert (img1.height);
alert(img1.width);
}
}
form name="form1" id="form1" method="post" enctype="multipart/form-data" onsubmit="return validate();"
This code is my own code to develope for avoiding server side validate
No comments:
Post a Comment