在图像上传时,我想用不同的名称和调整尺寸制作该图像的副本。
[HttpPost]
public ActionResult Create(HttpPostedFileBase photo)
{
string path = System.Configuration.ConfigurationManager.AppSettings["propertyPhotoPath"].ToString();
if ((photo != null) && (photo.ContentLength > 0))
{
var fileName = Path.GetFileName(photo.FileName);
var pathToSaveOnHdd = Path.Combine(Server.MapPath(path), fileName);
string dbPhotoPath = string.Format("{0}{1}", path, fileName);
}
...
// to do: make image copy, change dimensions
}