欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

JavaScript~~發(fā)送&接收文件流

  1. 獲取文件流

    創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元漳浦做網(wǎng)站,已為上家服務(wù),為漳浦各地企業(yè)和個人服務(wù),聯(lián)系電話:18980820575

var url = "/map/download?_beanid="+_beanid+"&buttonid="+buttonid;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = "blob";
xhr.onload = function() {
    if (this.status == 200) {
        //var blob = this.response;
        var blob = new Blob([this.response]);
        /*if(d.headers('content-disposition').indexOf('filename') != -1){
		    downloadTitle = d.headers('content-disposition').split(';')[1].split('=')[1];
		    downloadTitle = decodeURI(downloadTitle);
	        }待用*/
        if(typeof window.navigator.msSaveBlob !== 'undefined'){
		    window.navigator.msSaveBlob(blob, downloadTitle);
	        }else{
		    var objectUrl = URL.createObjectURL(blob);
		    var aForExcel = $("<a download='"+downloadTitle+"'><span class='forExcel'>下載excel</span></a>").attr("href",objectUrl);
		    $("body").append(aForExcel);
		    $(".forExcel").click();
		    aForExcel.remove();
	        }
        
        var _h = $(window).height();
        var $div=$("<div />");
        $div.dialog({
            "modal": true,
            "resizable": false,
            "showmax":false,
            "maxHeight": false,
            "maxWidth": false,
            "minHeight": 600,
            "minWidth": 50,
            "width":"100%",
            "height":_h,
            "draggable":false,
            "title":filename,
            "open":function(){
                var $ifr = "<iframe frameborder='0' width='100%' filename='"+filename+"' height='100%' id='fileImportIO' src='../struts/data/spread_ui.ftl'></iframe>";
                $div.append($ifr);
                $("#fileImportIO").data("fileIO",blob);
            },
            "close":function(event, ui){
                parent.$("#fileImportIO").attr("src","about:blank");
                $(event.target).closest("#wapper").empty().remove();
            }
        });
    }
}
xhr.send();

2.發(fā)送文件流

var xhr = new XMLHttpRequest();
xhr.open("POST", '/map/download!save', true);
xhr.onload = function (oEvent) {
	if(this.status == 200){
		if(this.response == "success"){
			alert(this.response);
		}
	}
};
xhr.send(blob);

名稱欄目:JavaScript~~發(fā)送&接收文件流
當(dāng)前網(wǎng)址:http://chinadenli.net/article48/gsgdhp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)商城網(wǎng)站外貿(mào)網(wǎng)站建設(shè)移動網(wǎng)站建設(shè)虛擬主機(jī)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)