1

Why does file uploaded with java s3 library have content type application/octet-stream when I access it from web even though I set the contentEncoding to text/html in the code when I upload it ?

ByteArrayInputStream contentsAsStream = new ByteArrayInputStream(contentAsBytes);
ObjectMetadata md = new ObjectMetadata();
md.setContentLength(contentAsBytes.length);
md.setContentEncoding("text/html");
s3.putObject(new PutObjectRequest(ARTIST_BUCKET_NAME, artistId, contentsAsStream, md));
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
  • 2
    Do you want to use setContentType() instead of setContentEncoding(). [See this answer](http://stackoverflow.com/a/23467253/3587167). – James Jun 04 '15 at 21:36
  • ah thankyou for that – Paul Taylor Jun 05 '15 at 08:05
  • @James Wing ah sorry my testing was flawed that hasnt actually fixed the problem, made no difference – Paul Taylor Jun 05 '15 at 09:23
  • if I name the file so it ends with .html it does work, but I want urls without the html at the end. – Paul Taylor Jun 05 '15 at 11:07
  • @Thilo not the same question because in this question I was inocrrectly using setContentEncoding() not setContentType(), I then fixed this coding error but it didnt resolve my issue - so I raised a new question for the new problem. – Paul Taylor Jun 08 '15 at 12:22

0 Answers0