【问题标题】:Ionic 3 Cordova File plugin gives error for copyFile operationIonic 3 Cordova File 插件为 copyFile 操作提供错误
【发布时间】:2018-09-10 16:06:02
【问题描述】:

我正在尝试使用copyFile(path, fileName, newPath, newFileName) 函数将文件从一个目录复制到另一个目录。它给出了类似{"code":13, "message":"input is not a directory"} 的错误。该文档只有 12 个错误代码,没有第 13 个。我想知道我做错了什么。

这是我的实际代码示例。

this.path = "file:///storage/emulated/0/TheFolder/thefile.ext";
this.newPath = "file:///storage/emulated/0/NewFolder";

this.fileCtrl.copyFile(this.path, fileName, this.newPath, newFileName)

【问题讨论】:

    标签: ionic-framework ionic3 cordova-plugins


    【解决方案1】:

    this.path 必须是一个目录,但您显示的是一些文件名

    如下修改你的代码

    this.path = "file:///storage/emulated/0/TheFolder";
    this.newPath = "file:///storage/emulated/0/NewFolder";
    
    this.fileCtrl.copyFile(this.path, YOUR_EXISTING_FILE_NAME, this.newPath, NEW_FILE_NAME);
    
    
    path -Base FileSystem
    fileName - Name of file to copy
    newPath - Base FileSystem of new location
    newFileName - New name of file to copy to (leave blank to remain the same)
    

    【讨论】:

      猜你喜欢
      • 2018-02-04
      • 2018-04-10
      • 1970-01-01
      • 2020-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-20
      • 2016-12-17
      相关资源
      最近更新 更多