fileOpener / Filetransfer的组合

时间:2019-09-02 08:00:26

标签: angular ionic3

我正在尝试使用Ionic 3打开和传输PDF文件

我尝试了多个站点,也尝试了文档,但我不断遇到错误3

uploadPDF() {
    const fileTransfer: FileTransferObject = this.transfer.create();
    const api = 'https://api.orz.co.za/products';

    let options: FileUploadOptions = {
       fileKey: 'notes_pdf',
       fileName: 'test.pdf',
       mimeType: 'application/pdf'
    }
    this.fileChooser.open()
      .then(uri => {
        fileTransfer.upload(uri, encodeURI(api), options, true)
        .then((data) => {
          this.showToast("Uploaded Successfully");
        }, (err) => {
          this.showToast(err.code);
          //error code 3
        })
      })
      .catch(e => this.showToast(e));
  }

吐司消息:错误3

0 个答案:

没有答案