Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work #2

Closed
theavijitsarkar opened this issue May 1, 2016 · 3 comments
Closed

Does not work #2

theavijitsarkar opened this issue May 1, 2016 · 3 comments

Comments

@theavijitsarkar
Copy link

I downloaded a MP4 using the file transfer plugin.
It went to success block, but no change in gallery

path ="file:///storage/emulated/0/Android/data/com.avifa.gifstar/files/c7eec950-0fd3-11e6-b695-7565d05cd59c.mp4"

         var onSuccess = function(result) {
              //Gets the server response object in the form of a string.
              console.log('saved')
          }

          var onFailure = function(errorMsg) {
              console.log("Media Refresh failed:" + errorMsg);
          }

          mediaRefresh.scanMedia(path,onSuccess,onFailure);

It works if the file is in the gallery folder. I have no idea on how to transfer the downloaded file to the gallery folder. In cordova how do i find the gallery folder path? Maybe I can directly download there

@saurabhgupta050890
Copy link
Owner

You can give the download target path to gallery path

@anujmpec
Copy link

anujmpec commented Sep 5, 2017

How can i give path to gallery path ?

@saurabhgupta050890
Copy link
Owner

// !! Assumes variable fileURL contains a valid URL to a path on the device,
// for example, cdvfile://localhost/persistent/path/to/downloads/

var fileTransfer = new FileTransfer();
var uri = encodeURI("http://some.server.com/download.php");

fileTransfer.download(
uri,
fileURL,
function(entry) {
console.log("download complete: " + entry.toURL());
},
function(error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("download error code" + error.code);
},
false,
{
headers: {
"Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
}
}
);

Here in fileUrl , you can give path to gallery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants