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

Vijaya Lakshmi updated CB-5576:
-------------------------------

    Description: 

Filetransfer download and upload are not working in Blackberry10 (Z10) phone

we have used below api for image upload

>From capture api we are taking fileuri

var options = new FileUploadOptions();
    options.fileKey="images[0]";
    options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
    options.mimeType="image/jpeg";


ft.upload(imageURI, serverURI, win, fail, options)

It is not working. 


Even download image from server also not working

Normal filetransfer.download not working. So we have tried below code that is 
also not working

window.requestFileSystem  = window.requestFileSystem || 
window.webkitRequestFileSystem;
                var xhr = new XMLHttpRequest();
                console.log("uri = "+uri);
xhr.open('GET', uri, true);
xhr.responseType = 'blob';
 
xhr.onload = function(e) {
 console.log("xhr onload funcation e"+e);
  window.requestFileSystem(PERSISTENT, 1024 * 1024 * 10, function(fs) {
  console.log("fs = "+fs);
    fs.root.getFile('/accounts/1000/shared/downloads/image.jpg', {create: 
true}, function(fileEntry) {
        console.log("file entry"+fileEntry);
      fileEntry.createWriter(function(writer) {
        console.log("writer created");
        writer.onwrite = function(e) { 
                console.log("writer on write = "+e.toString());

                };
        writer.onerror = function(e) {
                console.log("writer on error = "+e);
                };
        console.log("resp = "+xhr.response);
        var blob = new Blob([xhr.response], {type: 'image/jpg'});
        console.log("blob size is := "+blob.size);
        writer.write(blob);
 
      }, onError);
    }, onError);
  }, onError);
};
 
xhr.send();


Actually image.jpg file is created under '/accounts/1000/shared/downloads/' 
folder but not writing the blob cobntent into the file


  was:
Filetransfer download and upload are not working in Blackberry10 (Z10) phone




> Filet
> -----
>
>                 Key: CB-5576
>                 URL: https://issues.apache.org/jira/browse/CB-5576
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: BlackBerry
>    Affects Versions: 3.2.0
>            Reporter: Vijaya Lakshmi
>
> Filetransfer download and upload are not working in Blackberry10 (Z10) phone
> we have used below api for image upload
> From capture api we are taking fileuri
> var options = new FileUploadOptions();
>     options.fileKey="images[0]";
>     options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
>     options.mimeType="image/jpeg";
> ft.upload(imageURI, serverURI, win, fail, options)
> It is not working. 
> Even download image from server also not working
> Normal filetransfer.download not working. So we have tried below code that is 
> also not working
> window.requestFileSystem  = window.requestFileSystem || 
> window.webkitRequestFileSystem;
>               var xhr = new XMLHttpRequest();
>               console.log("uri = "+uri);
> xhr.open('GET', uri, true);
> xhr.responseType = 'blob';
>  
> xhr.onload = function(e) {
>  console.log("xhr onload funcation e"+e);
>   window.requestFileSystem(PERSISTENT, 1024 * 1024 * 10, function(fs) {
>   console.log("fs = "+fs);
>     fs.root.getFile('/accounts/1000/shared/downloads/image.jpg', {create: 
> true}, function(fileEntry) {
>       console.log("file entry"+fileEntry);
>       fileEntry.createWriter(function(writer) {
>       console.log("writer created");
>         writer.onwrite = function(e) { 
>               console.log("writer on write = "+e.toString());
>               };
>         writer.onerror = function(e) {
>               console.log("writer on error = "+e);
>               };
>       console.log("resp = "+xhr.response);
>         var blob = new Blob([xhr.response], {type: 'image/jpg'});
>       console.log("blob size is := "+blob.size);
>         writer.write(blob);
>  
>       }, onError);
>     }, onError);
>   }, onError);
> };
>  
> xhr.send();
> Actually image.jpg file is created under '/accounts/1000/shared/downloads/' 
> folder but not writing the blob cobntent into the file



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to