Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9837

Add data URI support to file-transfer upload on iOS

    XMLWordPrintableJSON

Details

    Description

      When I send an encoded base64 string image from iOS device with 'data:image/jpeg;base64,' at the beginning of data image on ft.upload(fileURL...) , plugin file transfer crash. However, on android works perfectly ONLY if line 'data:image/jpeg;base64,' is present.

      Possible solution:
      If I delete string data 'data:image/jpeg;base64,' for iOS devices and modify plugin file iOS 'CDVFileTransfer.m' like this:

      • (void)fileDataForUploadCommand:(CDVInvokedUrlCommand*)command
        {
        NSString* source = (NSString*)[command argumentAtIndex:0];
        NSData *fileData = [[NSData alloc] initWithBase64EncodedString:source options:NSDataBase64DecodingIgnoreUnknownCharacters];
        [self uploadData:fileData command:command];
        }

      works perfectly, but it wouldn't accept image path, only base64 string encoded images.

      Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            toni_reloaded Juan Antonio
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: