title: Returning a file to View and Download in .Net Core MVC 2.2
body: <p>In my controller, I want the user to view an image (could be jpg,giff,png,tiff) within the browser and also have the option to download the image.</p>
  <p>Currently, the former works. My controller code:</p>
  <pre><code>    public FileResult Index(string imageName)
      {
          var imageUploadPath = _configuration.GetValue&lt;string&gt;(&quot;ImageFileLocation&quot;);
          var path = string.Concat(imageUploadPath,  &quot;//&quot;, imageName);
  
          return new FileStreamResult(new FileStream(path, FileMode.Open), &quot;image/jpeg&quot;);
      }
  </code></pre>
  <p>I don't have a View for this and would prefer to keep it that way.</p>
  <p>I have tried to <code>return PhysicalFile</code> but that didn't work for me. Would hard coding the mime type as I have done currently have anything to do with this?</p>
  <p>Any help is appreciated,</p>
  <p>Thanks</p>