public static string SaveThumbnail(string tempPath, string oldPath, string configName, int txt_width, int txt_height, int txt_top, int txt_left, int txt_DropWidth, int txt_DropHeight) { var stream = UploadFileManager.GetUploadFile(tempPath, configName); //检查临时文件是否存在 if (stream != null) { var result = CutPhotoHelp.SaveCutPic(stream, 0, 0, txt_DropWidth, txt_DropHeight, txt_left, txt_top, txt_width, txt_height); stream.Close(); stream.Dispose(); string fileName = UploadFileManager.Save(result, oldPath, ".jpg", configName); UploadFileManager.RemoveUploadFile(tempPath, configName); return(fileName); } throw new ApplicationException("上传临时文件已被清除,请重新上传!"); }
/// <summary> /// 上传文件检查 /// </summary> /// <param name="file">文件信息</param> /// <param name="cfg">上传配置信息</param> public static void Check(HttpPostedFileBase file, string configName) { var cfg = UploadFileManager.GetUploadConfig(configName); Check(file, cfg); }
/// <summary> /// 保存上传文件 /// </summary> /// <param name="file">上传文件</param> /// <param name="fileName">保存文件名</param> /// <param name="configName">上传配置信息节点名称</param> /// <returns>返回地址</returns> public static string Save(HttpPostedFileBase file, string fileName, string configName) { var cfg = UploadFileManager.GetUploadConfig(configName); return(Save(file, fileName, cfg)); }
public static string Save(Stream stream, string fileName, string ext, string configName) { var cfg = UploadFileManager.GetUploadConfig(configName); return(Save(stream, fileName, ext, cfg)); }
/// <summary> /// 上传文件检查 /// </summary> /// <param name="file">文件信息</param> /// <param name="cfg">上传配置信息</param> public static void Check(IFormFile file, string configName) { var cfg = UploadFileManager.GetUploadConfig(configName); Check(file, cfg); }