繁体   English   中英

Phonegap / Cordova文件传输将图像上传为Base64字符串在ios中不起作用

[英]Phonegap / Cordova File Transfer Upload Image as Base64 String not working in ios

我正在努力将图像作为base64图像流从phonegap / cordova应用程序上传,它在Android中工作得非常好,但在ios中不起作用,但是在ios中,当图像为png / jpg但是当它作为base64图像流时它可以工作它不起作用,请任何人帮助我同样的。

这是我的相同代码,

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);
}

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

你可以在这里看到提交。

升级插件至少解决了我的问题。

使用base64使用phonegap上传时,将chunkMode设置为true

我设置chunkMode为true但仍然没有在服务器上传输文件。似乎cordova文件传输插件不支持在iOS上上传的base64图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM