加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在angularjs和express.js之间下载工作

发布时间:2020-12-17 07:57:11 所属栏目:安全 来源:网络整理
导读:我可以获取我请求的文件的原始数据,但我无法让浏览器向用户提供文件.我需要使用iframe吗? //Client code download_file: function (path,callback) { $http.post('/download/client_file',{path:path}). success(function(data,status,headers,config) { co
我可以获取我请求的文件的原始数据,但我无法让浏览器向用户提供文件.我需要使用iframe吗?
//Client code
   download_file: function (path,callback) {
       $http.post('/download/client_file',{path:path}).
           success(function(data,status,headers,config) {
                console.log(data); //this contains the raw data of the res.download 
                                   //from the server.
           });
   }

   //server code
   res.download(file); // the path is proper
我在我的服务文件中使用下面的代码来下载项目,它运行得很好.我从 http://filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/开始
$('<form action="'+ url +'" method="'+ ('post') +'">'+inputs+'</form>')
               .appendTo('body').submit().remove();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读