I need to differentiate between text file and image file without taking a look their path extension.
I would like to check if the file is actually the image or not. After searching, there is the way to check the mimetype from path extension, however, I would like the solution to verify the file's content itself.
UIImage *image = [UIImage imageNamed:@"SomeFile.xyz"];
if (image == nil) {
NSLog(@"This is probably text file");
}
If image is nil means the file may be text or another type of file.