zoukankan      html  css  js  c++  java
  • 请求文件下载URL过长处理

    /*
     * PostNewWin
     * Author:ppchen
     */
    var PostNewWin = function(url){
        var urlArr = url.split("?");
        var postUrl = urlArr[0];
        var postData = urlArr[1];
        var iframe = document.getElementById("postData_iframe");
        if(!iframe){
            iframe = document.createElement("iframe");
            iframe.id = "postData_iframe";
            iframe.scr= "about:blank";
            iframe.frameborder = "0";
            iframe.style.width = "0px";
            iframe.style.height = "0px";
            
            var form = document.createElement("form");
            form.id = "postData_form";
            form.method = "post";
            form.target = "_blank";
            
            document.body.appendChild(iframe);
            iframe.contentWindow.document.write("<body>" + form.outerHTML + "</body>");
        }
        iframe.contentWindow.document.getElementById("postData_form").innerHTML = "<input name='postData' id='postData' type='text' value='" + postData + "'/>";
        iframe.contentWindow.document.getElementById("postData_form").action = postUrl;
        iframe.contentWindow.document.getElementById("postData_form").submit();
    };

    /// <summary>
    /// 从Form中取得参数
    /// Author:ppchen
    /// </summary>
    /// <returns>参数集合</returns>
    private NameValueCollection ParseFormData()
    {
        NameValueCollection sQueryString = new NameValueCollection();
        if (this.Request.Form.Count > 0 && this.Request.Form["postData"] != null)
        {
            string sPostData = this.Request.Form["postData"].ToString();
            sPostData = sPostData.Trim(new char[] { '&', ' ' });
            if (!string.IsNullOrEmpty(sPostData))
            {
                string[] sParameterList = sPostData.Split('&');
                for (int i = 0; i < sParameterList.Length; i++)
                {
                    string[] sParameter = sParameterList[i].Split('=');
                    for (int j = 0; j < sParameter.Length; j = j + 2)
                    {
                        sQueryString.Add(sParameter[j], HttpUtility.UrlDecode(sParameter[j + 1]));
                    }
                }
            }
        }
        return sQueryString;
    }

  • 相关阅读:
    图片上传-下载-删除等图片管理的若干经验总结3-单一业务场景的完整解决方案
    图片上传-下载-删除等图片管理的若干经验总结2
    HDU 1195 Open the Lock
    HDU 1690 Bus System
    HDU 2647 Reward
    HDU 2680 Choose the best route
    HDU 1596 find the safest road
    POJ 1904 King's Quest
    CDOJ 889 Battle for Silver
    CDOJ 888 Absurdistan Roads
  • 原文地址:https://www.cnblogs.com/jordan2009/p/5955702.html
Copyright © 2011-2022 走看看