You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Juan Antonio (JIRA)" <ji...@apache.org> on 2015/10/21 16:09:27 UTC

[jira] [Updated] (CB-9837) iOS base64 string encoded images

     [ https://issues.apache.org/jira/browse/CB-9837?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juan Antonio updated CB-9837:
-----------------------------
    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.

  was:
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.


> iOS base64 string encoded images
> --------------------------------
>
>                 Key: CB-9837
>                 URL: https://issues.apache.org/jira/browse/CB-9837
>             Project: Apache Cordova
>          Issue Type: Bug
>            Reporter: Juan Antonio
>
> 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.



--
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