zoukankan      html  css  js  c++  java
  • 上传文件(文件另存为,有指定的路径)

    private SellerInfo uploadFile()     {         SellerInfo sellerInfo = new SellerInfo();

            String filePath = Server.MapPath("~/" + SellerReservatBL.SELLER_INFO_FILE);

            sellerInfo.ID = Request.QueryString["ID"];         sellerInfo.Sup_No = this.Sup_No.Text;         sellerInfo.Site_No = this.DlistStore.Text;         sellerInfo.EntryDate = this.ReservationDate.Text;         sellerInfo.SellerName = this.SellerName.Text;         sellerInfo.CardId = this.CardId.Text;         sellerInfo.Phone = this.Phone.Text;         sellerInfo.Brand = this.Brand.Text;         sellerInfo.OnlinePurchase = this.OnlinePurchase.Text;         sellerInfo.BussinessName = this.BussinessName.Text;         sellerInfo.BussinessPhone = this.BussinessPhone.Text;

            if (string.IsNullOrEmpty(this.FileUrl.Text))         {             if (!Directory.Exists(filePath + "/" + GetLoginUserNo()))             {                 Directory.CreateDirectory(filePath + "/" + GetLoginUserNo());             }

                if (string.IsNullOrEmpty(sellerInfo.ID))             {                 sellerInfo.ID = sellerBL.GetNextID("SellerInfo", "ID");             }

                HttpFileCollection hfc = Request.Files;             for (int i = 0; i < hfc.Count; i++)             {                 HttpPostedFile hpf = hfc[i];                 if (hpf.ContentLength > 0)                 {                     sellerInfo.AdjunctURL = filePath + "/" + GetLoginUserNo() + "/" + sellerInfo.Sup_No + "_" + sellerInfo.Site_No + "_" + sellerInfo.ID + ".rar";                 }             }

                for (int i = 0; i < hfc.Count; i++)             {                 HttpPostedFile hpf = hfc[i];                 if (hpf.ContentLength > 0)                 {                     hpf.SaveAs(sellerInfo.AdjunctURL);                 }             }         }         else         {             sellerInfo.AdjunctURL = this.FileUrl.Text;         }

            return sellerInfo;     }

  • 相关阅读:
    Linux 服务器配置网站以及绑定域名
    vmware 下的三种网络模式
    排序算法-python版
    python实例2-写一个爬虫下载小功能
    python学习-1-列表,元组,字典,集合,文件操作
    linux 10 -Bash Shell编程
    [ActionScript 3.0] AS3 3D双圆环贴图
    [ActionScript 3.0] AS3 3D星形贴图
    [ActionScript 3.0] AS3 绘制星形
    [ActionScript 3.0] AS3 获取函数参数个数
  • 原文地址:https://www.cnblogs.com/Carri/p/5405144.html
Copyright © 2011-2022 走看看