首页 > 其他分享 >下载附件

下载附件

时间:2022-10-10 15:22:56浏览次数:44  
标签:string jObject Put url 附件 下载 fileId

/// <summary>
        /// 弹出下载提示窗,下载文件至客户端本地。
        /// </summary>
        public void ShowDownload()
        {
            string _fileId = "7da03cadfb764f92a492d112f1568ca2";
            string url = FileServerHelper.GetAppSiteOuterNetUrl(this.Context, HttpContext.Current.Request);
            //fileId文件编码可由 T_BAS_ATTACHMENT 附件明细表查得,此处直接拿上面上传文件的编码来做示例。
            string fileurl = string.Format("{0}FileUpLoadServices/download.aspx?fileId={1}&token={2}", url, _fileId, this.Context.UserToken);
            //http://127.0.0.1/K3Cloud/FileUpLoadServices/download.aspx?fileId=7da03cadfb764f92a492d112f1568ca2&token=cf99615d-21ec-4646-bfee-5144da1b6e20
            JSONObject jObject = new JSONObject();
            jObject.Put("url", HttpUtility.UrlEncode(fileurl));
            jObject.Put("title", "文件下载");
            jObject.Put("desc", "请点击打开附件:");
            jObject.Put("urltitle", "这是文件名");
            this.View.AddAction(JSAction.openUrlWindow, new JSONArray { jObject });
        }

 

标签:string,jObject,Put,url,附件,下载,fileId
From: https://www.cnblogs.com/zouhuaxin/p/16775853.html

相关文章