apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
595 stars 888 forks source link

Compatibility with cordova-plugin-file@7 Android URLs #339

Open kryops opened 2 years ago

kryops commented 2 years ago

Hi there,

the new release 7.0.0 of cordova-plugin-file changed the format of URLs generated via file.toURL() and file.toInternalURL() from cdvfile://localhost/persistent/... to https://localhost/__cdvfile_persistent__/... on Android. This plugin does not seem to be able to handle them yet.

As a workaround, I am currently using file.nativeURL, which seems to work quite well.

Thanks for looking into it!

pixellet14 commented 2 years ago

Hi, I have also encountered that after installing this plugin the build fails. It is showing incompatibility issues

phusting commented 1 year ago

me too

pixellet14 commented 1 year ago

@phusting I have found the solution

phusting commented 1 year ago

@pixellet14 , AND?! :o) I'm using iOS and Android and I would love to continue to use file-transfer plugin if possible

pixellet14 commented 1 year ago

@phusting try this plugin https://www.npmjs.com/package/cordova-plugin-file-transfer-latest

phusting commented 1 year ago

@pixellet14 I will give it a try tomorrow. Thanks

pixellet14 commented 1 year ago

@phusting https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer This works!!! trust me!! i have just tried it

phusting commented 1 year ago

@pixellet14 you tested with plugin-file v7?

phusting commented 1 year ago

@phusting https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer This works!!! trust me!! i have just tried it

I get Invalid Version: null

pixellet14 commented 1 year ago

@phusting what's your cordova version? I am using 11

pixellet14 commented 1 year ago

@phusting see this...ignore the Response, as I haven't returned any json response in my serverside

https://user-images.githubusercontent.com/17765617/198649780-10a0e47c-02f9-4c90-ad9d-3a4499a6dba9.mp4

michaelpeterlee commented 1 year ago

@phusting https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer This works!!! trust me!! i have just tried it

I get Invalid Version: null

I received that also, however after installing via npm and then via cordova it built albeit does not solve the problem still.

terryjiang2020 commented 1 year ago

I start wondering if this plugin is still being maintained.

rolinger commented 1 year ago

@phusting https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer This works!!! trust me!! i have just tried it

I get Invalid Version: null

As @pixellet14 mentioned and posted earlier - this plugin works. I have it loaded and yes, I am able to get it work on both Cordova 11 for both Android@11 and iOS@6.2 (but I have only tested downloads; its all I need it for at the moment) with the following simply function:

  function DownloadFile(urlFile,newFileName,storage_location){
    var fileTransfer = new FileTransfer();
    var folderpath=storage_location+newFileName ; //The path is added here.
    var onSuccess= function(entry){
      console.log("download complete: " + entry.fullPath);
    };

    var onError=function(error) {
      console.log("download error source " + error.source);
      console.log("download error target " + error.target);
      console.log("upload error code " + error.code);
    };

    fileTransfer.download(urlFile,folderpath,onSuccess,onError);
  }