zoukankan      html  css  js  c++  java
  • 移动端实现附件下载

    (function(window) {
      /**
        下载文件
      @method app.download
      @static
      @param option {object}
      @param option.url {string} 下载的地址
      */
      app.download = function(option) {
        if (option && !option.attachmentUrl) {
          return;
        }
        var docuementName = option.attachmentName;
        var filePath = window.savePath + "/" + docuementName;
        console.log('下载处的filepath',filePath)
        var url = option.attachmentUrl;
        var fileTransfer = new FileTransfer();
        fileTransfer.download(
          url,
          filePath,
          function(entry) {
            //将文件路径保存起来,方便后面调用
            window.fileUri = entry.fullPath.replace("file:///", "file://");
            var URL = window.fileUri;
            app.openFile(URL, "", function(res) {
              app.hint("打开成功!");
            });
          },
          function(error) {
            console.log('打开失败')
            app.hint("下载失败!");
          }
        );
      };
    })(window);
  • 相关阅读:
    [SUCTF 2019]EasySQL
    [强网杯 2019]随便注
    [HCTF 2018]WarmUp
    Linux下配置JDK环境
    Centos克隆虚拟机后配置网络
    Sublime安装插件
    LeetCode-91-解码方法
    LeetCode-322-零钱兑换
    LeetCode-152-乘积最大子数组
    LeetCode-139-单词拆分
  • 原文地址:https://www.cnblogs.com/chchchc/p/12082285.html
Copyright © 2011-2022 走看看