我正在尝试使用 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)
最佳答案
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)
关于ionic-framework - Ionic 3 Cordova 文件插件为 copyFile 操作提供错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49594344/