You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Bryan Higgins (JIRA)" <ji...@apache.org> on 2014/01/09 17:32:51 UTC

[jira] [Commented] (CB-5576) Filet

    [ https://issues.apache.org/jira/browse/CB-5576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13866756#comment-13866756 ] 

Bryan Higgins commented on CB-5576:
-----------------------------------

Working on dev branch (see linked issue)

I'm able to do this:

new FileTransfer().download("https://www.google.ca/logos/doodles/2014/simone-de-beauvoirs-106th-birthday-5503387349024768-hp.jpg", "file:///accounts/1000/shared/camera/google.jpg", function () {
document.getElementById("img1").src = "file:///accounts/1000/shared/camera/google.jpg";
});

> 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.5#6160)