I have modified code based on this tutorial to display uploaded images in an angular project.
public uploadFile = (files) => {
if (files.length === 0) {
return;
}
var mimeType = files[0].type;
if (mimeType.match(/image\/*/) == null) {
this.message = "Only images are supported.";
return;
}
var reader = new FileReader();
reader.readAsDataURL(files[0]);
reader.onload = (_event) => {
this.imgURL = reader.result;
}
}
This works fine, the only thing is, I also want to check if the file is a video. Is the correct syntax
mimeType.match(/video\/*/)
?