public static void SaveFile(UploadConfig config)
        {
            if (config.FileBase == null || config.FileBase.ContentLength <= 0)
            {
                throw new FileNotFoundException("File not found.");
            }

            if (string.IsNullOrEmpty(config.FileName))
            {
                config.FileName = config.FileBase.FileName;
            }

            if (string.IsNullOrEmpty(config.FilePath))
            {
                config.FilePath = FilePath.DefaultRelativePath;
            }

            var fullPath = HttpContext.Current.Server.MapPath(Path.Combine(config.FilePath, config.FileName));

            var dir = Path.GetDirectoryName(fullPath) ?? string.Empty;

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            config.FileBase.SaveAs(fullPath);
        }
        private static UploadConfig UploadFile(HttpPostedFileBase fileBase)
        {
            var fileName = string.Format("{0}.{1}", Guid.NewGuid(), Path.GetFileName(fileBase.FileName));

            const string filePath = FilePath.DocumentRelativePath;

            var uploadConfig = new UploadConfig
            {
                FileBase = fileBase,
                FileName = fileName,
                FilePath = filePath
            };

            try
            {
                FileHelper.SaveFile(uploadConfig);
            }
            catch (Exception)
            {
                return new UploadConfig();
            }

            return uploadConfig;
        }