System.Web.HttpRequest.MapPath C# (CSharp) Method

MapPath() public method

public MapPath ( string virtualPath ) : string
virtualPath string
return string
		public string MapPath (string virtualPath)
		{
			if (worker_request == null)
				return null;

			return MapPath (virtualPath, BaseVirtualDir, true);
		}

Same methods

HttpRequest::MapPath ( string virtualPath, string baseVirtualDir, bool allowCrossAppMapping ) : string

Usage Example

Example #1
0
 public static int AddTalentDocument(HttpRequest req, ref string message, ref string  forwardurl)
 {
     if (req.Files[0].ContentLength != 0)
     {
         Model.TB_RC_TalentDocument model = new Model.TB_RC_TalentDocument();
         model.TD_CB_No = Convert.ToInt32(Common.Constants.getReqValue(req, "CB_No"));
         model.TD_TI_No = Convert.ToInt32(Common.Constants.getReqValue(req, "TI_No"));
         forwardurl = "TalentInfo/TalentDocument.aspx?CB_No=" + model.TD_CB_No + "&TI_No=" + model.TD_TI_No;
         var tmpext = Common.Constants.GetFileExt(req.Files[0].FileName);
         string filedir = req.MapPath("newImages") + "\\";
         string filename = DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss") + Common.Constants.getGuid() + "." + tmpext;
         req.Files[0].SaveAs(filedir + filename);
         model.TD_DocName = System.IO.Path.GetFileName(req.Files[0].FileName);
         model.TD_docPath = filename;
         model.TD_CreateDate = DateTime.Now;
         model.TD_CreatePer = "";
         tddb.Add(model); 
         message = "添加文档成功";
        
     }
     else
     { 
         message = "文件内容为空" ;
         return Common.Constants.ERR;
     }
     return Common.Constants.OK;
 }
All Usage Examples Of System.Web.HttpRequest::MapPath