/// <summary> /// 将文件的URL路径转换为物理路径 /// </summary> /// <param name="path">URL路径</param> /// <returns></returns> private static string MapPath(string path) { if (path.StartsWith("..") || path.StartsWith("~/") || path.StartsWith("/")) { return(ALHttpIO.MapPath(path)); } else { return(path); } }
/// <summary> /// 根据相对路径(结合绝对地址),获取物理路径 /// </summary> /// <param name="path">相对路径</param> /// <returns></returns> protected string MapPath(string path) { switch (this._mode) { case 0: case 1: return(ALHttpIO.MapPath(path, _dirPath)); case 2: return(HttpContext.Current.Server.MapPath(path)); default: return(path); } }
/// <summary> /// 用于存储到硬盘的构造函数 /// </summary> public BiAttachHelper(string filePath, int mode) { this._dirPath = ALHttpIO.MapPath("~/"); this._filePath = filePath; this._mode = mode; }