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);
            }
        }

  • 相关阅读:
    直接报错了:无法加载文件 C:UsersAdministratorAppDataRoaming pmvue.ps1,因为在此系统中禁止执行脚本
    [vue系列]-vue+vue-i18n+elementUI 国际化
    new vue 实例发生了什么呢?
    vue引用外部JS的两种方案
    web轻量级富文本框编辑
    Cannot read property '_withTask' of undefined
    element 动态合并表格
    前端如何获取原始图片大小
    ASP.Net Core使用Ajax局部更新
    ASP.NET Core中的jQuery Unobtrusive Ajax帮助器
  • 原文地址:https://www.cnblogs.com/hyd309/p/1300021.html
Copyright © 2011-2022 走看看