Chapter 3 of 6 · 1 min

How do I open a PDF from S3 in the browser instead of downloading it?

SHORT ANSWER

Set two labels on the file: the kind (PDF) and the behaviour (show, not save). With both right, the PDF opens in the tab; with either wrong, the browser downloads it.

The lesson 4 film is on chapter 1.

The two labels

  • Content-Type says what kind of file it is. Files uploaded without one get "unknown binary", and the browser saves anything unknown.
  • Content-Disposition says show it or save it: inline, or attachment.

Three ways to fix it

  • Change the labels on the file by copying it onto itself with new ones. A programmer does this in one command.
  • Leave the file alone and make a share link that overrides the labels for that one visit. The Open button in the console does exactly that.
  • Open it through a workspace, which sets both labels for every preview.

The same two labels decide the behaviour for images, text, audio and video. They do nothing for Word, Excel and PowerPoint, which the next answer covers.

Four ways to open an S3 file in the browser has every rate and the steps.

NEXT · CHAPTER 4 OF 6Can an Excel file open in the browser?Not on its own. Here is what gets it open.
The same bucket, two ways

See the steps to open, share and give a colleague access in the AWS Console and in BucketDesk, side by side.

Compare with the AWS Console