【问题标题】:ionic + Android 9 + File Transfer离子 + Android 9 + 文件传输
【发布时间】:2020-10-09 20:10:57
【问题描述】:

我正面临 ionic4 文件传输的问题, android 9 无法进行文件传输, 我在 android 9 下进行了测试,它工作正常。

ionic cordova plugin add cordova-plugin-file-transfer
npm install @ionic-native/file-transfer

我的代码是

uploadImageFile() {
var options: FileUploadOptions = {
  fileKey: "userPhoto",
  mimeType: "image/jpeg",
  chunkedMode: false,
}

this.URL = 'http://webservicelink.in:1224/mobile/upload';

this.FileUpload.upload(this.imageURI, this.URL, options)
  .then((data) => {
   alert("Success uploading image");
  })
  .catch((err) => {
    alert("Error uploading image");
  });
}

错误

{"code":3"source":"file///stoRAGE/EMULATED/0/xENDER/PHOTO/20190704-wa003.jpeg","target":"http://webservicelink.in:1224/mobile/upload","http_status":null ,"body":null,"Exception":"写入错误:ssl0x7cf2dd3f88:I/O error during system call,Broken pipe"}

【问题讨论】:

    标签: ionic-framework ionic4 ionic-native


    【解决方案1】:

    文件传输已弃用

    https://github.com/apache/cordova-plugin-file-transfer

    已弃用 XMLHttpRequest 中引入的新特性,这个插件不是 需要更多。从这个插件迁移到使用新功能 XMLHttpRequest,在这篇 Cordova 博客文章中进行了解释。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      • 1970-01-01
      • 2013-01-18
      • 2020-07-02
      • 1970-01-01
      相关资源
      最近更新 更多