zoukankan      html  css  js  c++  java
  • 上传、下载服务器文件

    下载:

    string strFileName = Server.UrlDecode(Server.UrlDecode(FileName));
                        Response.AppendHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(strFileName));
                        Response.ContentType = "application/force-download";
                        if (System.IO.File.Exists(strFilePath + strFileName))
                        {
                            BM1.IBLL.IFileViewBLL bll = BM1.Factory.BLLFactory.CreateIFileViewBLL();
                            ArrayList list = bll.Document(Session["CMP_ID"].ToString(), FileName.Split('.')[FileName.Split('.').Length-2].ToString(),Convert.ToDateTime(DG1.Items[i].Cells[4].Text));
                            foreach (object obj in list)
                            {
                                FileRgstVO fr = (FileRgstVO)obj;
                                bll.Down_Rec(Session["CMP_ID"].ToString(), Session["USER_ID"].ToString(), System.DateTime.Now, FileName.Split('.')[FileName.Split('.').Length - 2].ToString(),fr.GetVersion_No,fr.GetPath,fr.GetType,fr.GetRemark);
                            }

                            Response.WriteFile(strFilePath + strFileName);
                            Response.End();

    上传:

        private void UploadFile(string To_Path) //上传文件
        {
            string path = To_Path + Request.Form["Tbx_FileName"].ToString()+"."+ Request.Form["TbxName"].ToString();
            if (File.PostedFile.ContentLength != 0)
            {           
                File.PostedFile.SaveAs(path);
            }
        }

  • 相关阅读:
    ASP.NET Core 发布 centos7 配置守护进程
    AutoMapper在asp.netcore中的使用
    git忽略文件并删除git仓库中的文件
    Animate.css 一款牛逼的css3动画库
    URL中特殊符号的处理
    efcore 配置链接sqlserver
    简单抓取小程序大全,并展示。
    UEditor上传图片到七牛C#(后端实现)
    软件项目管理三国启示录01 群雄争霸之项目经理的自我修养
    【调侃】IOC前世今生
  • 原文地址:https://www.cnblogs.com/hyd309/p/1300021.html
Copyright © 2011-2022 走看看