ionic-framework - Ionic 3 Cordova 文件插件为 copyFile 操作提供错误

标签 ionic-framework ionic3 cordova-plugins

我正在尝试使用 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/

相关文章:

android-studio - ionic 电容器应用程序给了我很多错误

css - 在 ionic 3 上组织网格

多次触发 Angular @HostListener 事件

node.js - 如何在不使用命令 npm 的情况下向 cordova/phonegap 应用程序添加插件?

ios - Cordova : pause event doesn't fire when receiving a phone call on iphone

ionic-framework - 使用 Ionic-v3 加载位于设备内部的视频时,HTML5 视频播放器出现错误

ionic3 - 禁用按钮的 ionic 更改字体颜色

in-app-purchase - 应用内购买对象 {消息 : "Billing is not initialized", 代码 : -3, 错误代码:-3}

android - Cordova:android.json 中的 PACKAGE_NAME 是什么意思?

javascript - Angular.js ng-submit 触发了两次并且没有从表单中获取值