i have create one file input type for upload file......how to check the path in the text field is what i want? i mean like only able to upload jpg file, gif file and so on.....is it need java script?
Printable View
i have create one file input type for upload file......how to check the path in the text field is what i want? i mean like only able to upload jpg file, gif file and so on.....is it need java script?
You would need to do a server-side validation (such as PHP, ASP, CGI, etc) for that. Even then, it is not straightforward to check the type, although you could just assume the file extension is correct.
how about this lines code, is it about validate the file type??
Code:if((document.form1.upload.value.lastIndexOf(\”.jpg\”)==-1) {
alert(\”Please upload only .jpg extention file\”);
return false;
}
And if I have Javascript disabled? (Which, BTW, I do for most sites).
That's why you need a server-side check. Maybe a JS one too but always a server-side to fall back on.
ok........i will do server-side validation.!!