<script language="javascript">
function validateFileupload()
{
//Validating FIle SIZE
if((Math.round(document.getElementById("file1").files[0].size)/(1024*1024)) > 4)
{
alert('Document is not UPLOADED. Maximum file size is restricted to 2MB.Please try again Uploading other document!!');
return false;
}
//VALIDATING FILE TYPE
var ext = document.Form1.file1.value;
ext = ext.substring(ext.length-3,ext.length);
ext = ext.toLowerCase();
if(ext.length > 0)
{
if((ext != 'pdf') && (ext != 'xls') && (ext != 'xlsx') && (ext != 'doc') && (ext != 'docx') && (ext != 'png') && (ext != 'jpg')) {
alert('You selected a .'+ext+' file in policy Docs; Only files with following extensions are allowed (pdf,xls,xlsx,doc,docx,png,jpg)!');
return false;
}
else
return true;
}//if
}//FUNC TION END
</script>
function validateFileupload()
{
//Validating FIle SIZE
if((Math.round(document.getElementById("file1").files[0].size)/(1024*1024)) > 4)
{
alert('Document is not UPLOADED. Maximum file size is restricted to 2MB.Please try again Uploading other document!!');
return false;
}
//VALIDATING FILE TYPE
var ext = document.Form1.file1.value;
ext = ext.substring(ext.length-3,ext.length);
ext = ext.toLowerCase();
if(ext.length > 0)
{
if((ext != 'pdf') && (ext != 'xls') && (ext != 'xlsx') && (ext != 'doc') && (ext != 'docx') && (ext != 'png') && (ext != 'jpg')) {
alert('You selected a .'+ext+' file in policy Docs; Only files with following extensions are allowed (pdf,xls,xlsx,doc,docx,png,jpg)!');
return false;
}
else
return true;
}//if
}//FUNC TION END
</script>
No comments:
Post a Comment