Tengo una api para subir imagenes pero la extension jpeg y jpg las sube dañadas. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> [HttpPatch("{IdCat}/{Id}")] public ActionResult PatchT(int IdCat, int Id, [FromForm] IFormFile file) { try { string main_path = "//xxx.xxx.0.21/recursos/"; string pathString = System.IO.Path.Combine(main_path, IdCat.ToString()); //System.IO.Directory.CreateDirectory(pathString); if (!System.IO.File.Exists(pathString)) { System.IO.Directory.CreateDirectory(pathString); } var model = _context.AuditoriaFoto.Find(Id); if (model.Id == Id) { if (file != null) { var extension = Path.GetExtension(file.FileName).Substring(1); var path = pathString + "/" + Id + "."+ extension; using (var stream = System.IO.File.Create(path)) { file.CopyToAsync(stream); } model.Ruta = path; model.extension = extension; } _context.SaveChanges(); return Ok(model); } else { return BadRequest(); } } catch (Exception e) { return BadRequest(e.Message); } } <!-- end snippet -->