I am trying to detect files with types image or video
. However, despite checking for the correct file type, I am still encountering errors. Below is my code:
app.component.ts
startUpload(event: FileList)
{
const file = event.item(0);
if((file.type.split('/')[0] !== 'video') || (file.type.split('/')[0] !== 'image'))
{
alert(file.type.split('/')[0]);
return;
}
}
When uploading video/image files, the alert box displays video/image accordingly. Please advise on what changes need to be made.