I am validating file extensions before uploading.
We are using File reader to read contents. But while accepting .zip file is there a way to get the file extensions inside the zip file which we are trying to upload.
const validFileExtensions:string[]=['doc','xls','html','zip'];
private ValidateFileExtesnion(file:File)
{
if(this.validFileExtensions.forEach(ext=>{
result.push(file.name.endsWith(ext)?true:false,);
});
if(result.indexOf(true)==-1)
{
alert("Not valid File");
}
}
Please let me know how can we validate file extensions inside the zip file with out using any using any plugins .