To know MIME type...
-(void)knowmimetype {
NSString *path = [url path];
NSString *mimetype = [self mimeTypeForPath:path];
}
- (NSString *)mimeTypeForPath:(NSString *)path {
// get a mime type for an extension using MobileCoreServices.framework
CFStringRef extension = (__bridge CFStringRef)[path pathExtension];
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension, NULL);
assert(UTI != NULL);
NSString *mimetype = CFBridgingRelease(UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType));
assert(mimetype != NULL);
CFRelease(UTI);
DLog(@"mimetype of a File : ++++>> %@",mimetype);
return mimetype;
}
No comments:
Post a Comment