public IActionResult Get(string file = null) { if (string.IsNullOrWhiteSpace(file)) { return(Forbid()); } var path = Path.Combine(env.ContentRootPath, "uploads", file); if (!Files.Exists(path)) { return(NotFound(new { success = false, errormsg = $"File not found {file}" })); } return(new PhysicalFileResult(path, new MediaTypeHeaderValue(Mime.TypeOf(path)))); }