Before uploading files to my server, I always make sure to check the file type. However, I have encountered an issue - the file type check is only effective for png files and not jpeg:
for(var j = 0; j < $files.length; j++) {
if(!$files[j].type.match('image/png') || !$files[j].type.match('image/jpeg')) {
$scope.all_files_images = false;
}
}
Strange thing is that when the file type is image/jpeg, the statement $scope.all_files_images = false;
gets executed even though it shouldn't. It works perfectly fine for png files. Upon verifying the file types, everything seems normal.