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

  • 相关阅读:
    C++随机迷宫生成[转载]
    浮点指令
    表盘
    TabControl+ListView
    ListView
    Tooltips2
    随机数
    Tooltips
    iOS9 http不能访问网络——在Xcode中将https改成http方式
    iOS开发——音频篇——音效的播放
  • 原文地址:https://www.cnblogs.com/Carri/p/5405144.html
Copyright © 2011-2022 走看看