Full version: jsB@nk » Utility » File Extension script
URL: https://www.javascriptbank.com/file-extension-script.html
Use this JavaScript to check the extension of a file.
Full version: jsB@nk » Utility » File Extension script
URL: https://www.javascriptbank.com/file-extension-script.html
<SCRIPT language=javascript>/**************************************************************//* You may freely distribute and modify the following code, *//* but please don't delete the refference to my email id, so *//* that people could ask the updates on it ... THANK YOU *//* AUTHOR: Kochu *//* EMAIL: [email protected] *//**************************************************************/function check(){if(document.frm.F1.value==""){alert("Please select the image")return false}// You can modify the file extentions to which ever file extensions you want to unblock// Example you can modify ".jpg" extension to ".bmp" extension if you want to allow ".bmp" file to upload.if((document.frm.F1.value.lastIndexOf(".jpg")==-1) && (document.frm.F1.value.lastIndexOf(".gif")==-1)){alert("You can upload only GIF and JPG extention files")return false}return true}</SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<FORM name=frm onsubmit="return check(this)" action=test.asp method=post encType=multipart/form-data> <P><INPUT type=file name=F1 size="20"></P> <P><INPUT type=submit value=Submit name=B1><INPUT type=reset value=Reset name=B2></P></FORM><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->