コード例 #1
0
ファイル: FileUpload.cs プロジェクト: HarveyHuBJ/AK47Source
        private static string GetUploadRootPath(string rootPathName)
        {
            ExceptionHelper.CheckStringIsNullOrEmpty(rootPathName, "rootPathName");

            AppPathSettingsElement elem = AppPathConfigSettings.GetConfig().Paths[rootPathName];

            ExceptionHelper.FalseThrow(elem != null, "不能在配置节appPathSettings下找到名称为\"{0}\"的路径定义", rootPathName);

            return(elem.Dir);
        }
コード例 #2
0
ファイル: FileUpload.cs プロジェクト: HarveyHuBJ/AK47Source
        /// <summary>
        /// </summary>
        /// <param name="pType"></param>
        /// <param name="fileRelativePath"></param>
        /// <returns></returns>
        internal static string GetFileFullPath(PathType pType, string rootPathName, string fileRelativePath)
        {
            string fileFullPath   = string.Empty;
            string uploadRootPath = GetUploadRootPath(rootPathName);

            if (pType == PathType.relative)
            {
                fileFullPath = uploadRootPath + fileRelativePath;

                AppPathConfigSettings.GetConfig().CheckPathIsConfiged(fileFullPath);
            }
            else
            {
                fileFullPath = HttpContext.Current.Server.MapPath(fileRelativePath);

                CheckTemplateFile(fileFullPath);
            }

            return(fileFullPath);
        }