Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 197D3175C3 for ; Wed, 25 Feb 2015 17:46:05 +0000 (UTC) Received: (qmail 62191 invoked by uid 500); 25 Feb 2015 17:46:04 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 62168 invoked by uid 500); 25 Feb 2015 17:46:04 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 62146 invoked by uid 99); 25 Feb 2015 17:46:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Feb 2015 17:46:04 +0000 Date: Wed, 25 Feb 2015 17:46:04 +0000 (UTC) From: "Mike Mullins (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CB-8546) MimeType of camera (or otherwise) file in IOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Mike Mullins created CB-8546: -------------------------------- Summary: MimeType of camera (or otherwise) file in IOS Key: CB-8546 URL: https://issues.apache.org/jira/browse/CB-8546 Project: Apache Cordova Issue Type: New Feature Components: iOS, Plugin File Affects Versions: 4.0.0 Environment: OS: Mac OS X Yosemite Node Version: v0.12.0 Cordova CLI: 4.2.0 Xcode version: Xcode 6.1.1 Build version 6A2008a ios-sim version: 3.1.1 Reporter: Mike Mullins Would love to be able to get actual file mimetype (not just an extension guess) on locally uploaded files in cordova on ios.
	window.resolveLocalFileSystemURL(imageData, function(fileEntry) {
				fileEntry.file(function(filedata) {
					console.log(filedata);
				});
			}, errorCB2); 
returns type: nill i've noticed in the CDVlocalfilesystem.m file that this appears to be of note, would love to see it pushed up the list a bit!
 // can't easily get the mimetype unless create URL, send request and read response so skipping
- (void)getFileMetadataForURL:(CDVFilesystemURL *)localURL callback:(void (^)(CDVPluginResult *))callback
{
    NSString *path = [self filesystemPathForURL:localURL];
    CDVPluginResult *result;
    NSFileManager* fileMgr = [[NSFileManager alloc] init];

    NSError* __autoreleasing error = nil;
    NSDictionary* fileAttrs = [fileMgr attributesOfItemAtPath:path error:&error];

    if (fileAttrs) {

        // create dictionary of file info
        NSMutableDictionary* fileInfo = [NSMutableDictionary dictionaryWithCapacity:5];

        [fileInfo setObject:localURL.fullPath forKey:@"fullPath"];
        [fileInfo setObject:@"" forKey:@"type"];  // can't easily get the mimetype unless create URL, send request and read response so skipping
        [fileInfo setObject:[path lastPathComponent] forKey:@"name"];

        // Ensure that directories (and other non-regular files) report size of 0
        unsigned long long size = ([fileAttrs fileType] == NSFileTypeRegular ? [fileAttrs fileSize] : 0);
        [fileInfo setObject:[NSNumber numberWithUnsignedLongLong:size] forKey:@"size"];

        NSDate* modDate = [fileAttrs fileModificationDate];
        if (modDate) {
            [fileInfo setObject:[NSNumber numberWithDouble:[modDate timeIntervalSince1970] * 1000] forKey:@"lastModifiedDate"];
        }

        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:fileInfo];
-- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org