PhoneGap的/科尔多瓦文件传输上传图片为Base64字符串不是在工作的ios [英] Phonegap / Cordova File Transfer Upload Image as Base64 String not working in ios

查看:184
本文介绍了PhoneGap的/科尔多瓦文件传输上传图片为Base64字符串不是在工作的ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在上传图像作为的PhoneGap /科尔多瓦应用的base64图像流,它工作完全正常的,但Android的iOS中不工作,然而,在IOS当图像为PNG / JPG格式,但它的工作原理,当它是作为的base64图像流它不工作,请任何人可以帮助我一样。

下面是我的code为相同,

  VAR选项=新FileUploadOptions();
    options.fileKey =文件;
    options.fileName =test.jpg放在
    options.mimeType =图像/ JPEG;
    options.chunkedMode = FALSE;     options.params = {
                钥匙:test.jpg放在
                AWSAccessKeyId:awsKey,
                以acl:ACL,
                政策:policyBase64,
                签名:签名,
                内容类型:
            };    VAR英尺=新的文件传输();
    ft.upload(imageURI,s3URI +,
            胜利,失败,期权);
}
功能赢(R){
    的console.log(code =+ r.response code);
    的console.log(响应=+ r.response);
    的console.log(已发送=+ r.bytesSent);
    警报(r.response);
}
功能失效(错误){
    (发生错误:code =+错误code)警报;
}


解决方案

文件传输的插件版本1.5.0已经增加了该功能。该补丁应用于2015年12月14日。

您可以看到提交的这里

升级插件,在我的情况下解决了这个问题最少。

I'm working on uploading image as base64 image stream from phonegap/cordova application, it works perfectly fine in Android but not working in ios, however in ios it works when the image is as png/jpg but when it is as base64 image stream its not working, Please can anybody help me out with the same.

Here is my code for the same,

var options = new FileUploadOptions();
    options.fileKey = "file";   
    options.fileName = "test.jpg";
    options.mimeType = "image/jpeg";    
    options.chunkedMode = false;

     options.params = {
                "key": "test.jpg",
                "AWSAccessKeyId": awsKey,
                "acl": acl,
                "policy": policyBase64,
                "signature": signature,
                "Content-Type": ""
            };

    var ft = new FileTransfer();
    ft.upload(imageURI, s3URI + "",
            win, fail, options);
}
function win(r) {
    console.log("Code = " + r.responseCode);
    console.log("Response = " + r.response);
    console.log("Sent = " + r.bytesSent);
    alert(r.response);
}
function fail(error) {
    alert("An error has occurred: Code = " + error.code);
}

解决方案

Version 1.5.0 of the file transfer plugin has already added that functionality. The patch was applied 14 Dec 2015.

You can see the commit here.

Upgrading the plugin solved the problem in my case at least.

这篇关于PhoneGap的/科尔多瓦文件传输上传图片为Base64字符串不是在工作的ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆