If instead of just adding links from the documents stored on Amazon S3 to your website you wanted downloaded them, all we have to do is come over here to the S3 Management Console and select meta data.
Set Content Disposition to Attachment
Then we’re going to add more meta data and the data that we’re going to add is content disposition. And we’re going to choose attachment. So select content disposition and the value of attachment and save it.
And now the next request is going to result in a download rather than opening up in a browser window. So we’re going to refresh this page here and once the page is refreshed, when we click on this download free ebook you can see the download is starting, right? It’s no longer attempting to open up and that’s because we set that content disposition to attachment.
Audio File Example
Now, this actually happens in other context. So for example, if we go to our audios and open up the details. Let’s go ahead and say download the free audio. Hit the link button, come back over here and copy the link address. Paste it there and hit update and then refresh this page. Click on the download the free audio and we’re going to have the same thing happen here in the browser. The browser’s going to open up and start playing the audio.
And so this is also not what we want and since it’s not what we want, we’re going to set that content disposition in meta data. Add more meta data, content disposition, attachment and save. And while we’re at it, let’s just go ahead and take a look at the video, see if the video has finished uploading. Nope, video is still in the process. It’s very close but it’s still not quite uploaded.
Now if we come over here and click the free audio this time… no, I have to refresh my page. And now set the audio… maybe I didn’t save that. Audios, Properties… I guess I didn’t save it. Okay, now that that’s saved, let’s try it again. It could be also that my browser’s not going to pay attention to that since it’s cached and that’s what’s happening here is that my browser has cached this file.
So I suppose we can test that in a different browser just to make sure that I’m right. Download the free audio. Okay, so Internet Explorer is asking me if I want to open it or save it. So if I hit save it, it’s going to download. Let’s we’ll cancel that though.
Video File Example
And the process is exactly the same thing for the video. You create a link, you put the link text in there, select the link text, hit the link button and then go over to your bucket and get the file. So here’s the file and if I hit Properties and down to permissions, I’m going to add one more permission and this permission is to everyone and they can open it.
We’ll save those permissions and go down to meta data and we’re going to add one more piece of meta data and that’s content disposition and attachment and we’ll save that. And now the video itself would download.
If you’re doing this in WP eStore and this is a product, you don’t have to set the permissions but you still need to set this attachment stuff, the content disposition or the browser will take responsibility and do what it wants to do. So setting up this content disposition value attachment is a critical aspect to making the downloads work.