列“ _data”不存在。可用列:[]在ionic3中选择文件后?

时间:2019-12-18 11:55:53

标签: ionic3 cordova-plugin-file

我已经实现了上传证书功能,但是在文件上传过程中遇到了以上错误,并且我正在使用fileChooser插件,我的文件返回URL将是

content://com.xxx.xxx.sharing.provider/root/storage/emulated/0/Android/data/com.xxx.xxx/files/attachments/attachment-1.jpg

selectFile(){
   this.fileChooser.open().then(uri => {
    //
    this.documentPath = 'file://'+ uri;
    this.filePath.resolveNativePath(this.documentPath).then(filePath => {
      let correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
      let currentName = this.documentPath.substring(this.documentPath.lastIndexOf('/') + 1, this.documentPath.lastIndexOf('?'));
      let fileExtension = filePath.substring(filePath.lastIndexOf('.') , filePath.length);
      this.copyFileToLocalDirPan(correctPath, currentName, this.createFileNamePan(fileExtension));
    });
  }).catch(err => console.log(err));
}

   /**
      Summary: createFileNamePan for get file name with extentation...
      return : newFileName
    **/
     createFileNamePan(fileExtension) {
        var d = new Date(),
        n = d.getTime(),
        newFileName =  n + fileExtension;//".png";
        return newFileName;
    }

如果我已将上述文件添加到此扩展名-'file://'+我遇到了以下错误:

  

ERROR错误:未捕获(承诺):[object Object]

下面我们更新了小提琴,谁能告诉我如何解决以上问题?

0 个答案:

没有答案