How do you get the file stream of an uploaded image (IFormFile) and resize it?
public ActionResult Upload(IFormFile file)
{
using (var reader = new StreamReader(file.OpenReadStream()))
{
var fileContent = reader.ReadToEnd();
var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
//scale image here?
}
}
You can use
IFormFile.OpenReadStream()to get the stream, and then just insert the stream into anImage. For this instance I scaled it to 1024x768.You can then use
newImageto save or do whatever you want with.