title: Spring AWS S3: How to upload an image and get a URL which shows it rather than downloads it?
body: <p>So my problem's that when I open the URL of the uploaded file, it downloads it. 
  I did some research and the problem's that I should somehow specify to S3 that its an image.
  Currently this's the function that handles the upload but I don't know how could I set the type there.
  Or is there a built in function that recognises the images and when the URL is opened it shows them automatically rather than downloads them?</p>
  
  <p>Thanks</p>
  
  <pre><code>public void writeResource(byte[] bytes, String fileName) throws IOException
  {    
     Resource resource = this.resourceLoader.getResource("s3://bucket/" + fileName);
     WritableResource writableResource = (WritableResource) resource;
     try (OutputStream outputStream = writableResource.getOutputStream())
     {
        outputStream.write(bytes);
     }
  }
  </code></pre>