Open raedhellal opened 2 years ago
Hello,
Is there a way around this? We are trying to upload HEIF images from iOS devices (with an file extension of heic
) and the contentType seems to be coming back as application/octet-stream
and this is causing some issues for us because we need to redirect them for processing based on the contentType if they are heif images.
I had a problem with uploading document and the issue is that the content type is always "application/octet-stream" when i checked the code i found this function:
/ Borrowed from http://stackoverflow.com/questions/2439020/wheres-the-iphone-mime-type-database /
(NSString )guessMIMETypeFromFileName: (NSString )fileName { CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[fileName pathExtension], NULL); CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);
if (UTI) { CFRelease(UTI); }
if (!MIMEType) { return @"application/octet-stream"; } return (__bridge NSString *)(MIMEType); }
i guess this two lines don't work anymore to determine MIMEType CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[fileName pathExtension], NULL); CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);
it is always null