Skip to content

Instantly share code, notes, and snippets.

@chsami
Last active October 5, 2020 17:35
Show Gist options
  • Save chsami/f89656df92657708e1c432c17b3055e9 to your computer and use it in GitHub Desktop.
Save chsami/f89656df92657708e1c432c17b3055e9 to your computer and use it in GitHub Desktop.
[HttpPost]
public ActionResult UploadFile()
{
var Files = Request.Form.Files; // Load File collection into HttpFileCollection variable.
//I ONLY TAKE THE FIRST FILE FOR EXAMPLE PURPOSES
var imageStream = Files[0].OpenReadStream();
var directories = ImageMetadataReader.ReadMetadata(imageStream);
var exifSubDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();
var originalDate = exifSubDirectory?.GetDescription(ExifDirectoryBase.TagDateTimeOriginal);
return Ok(originalDate)
}
@MichaelMedi
Copy link

Why are you using the using(var ms = new MemoryStream())? What is the xyz var?

@chsami
Copy link
Author

chsami commented Oct 5, 2020

Why are you using the using(var ms = new MemoryStream())? What is the xyz var?

leftover code. fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment