Allow users to download media files directly from Amazon S3 (AWS plugin)

You’re going to have to choose between having the file served directly from S3 or having it pop up with a download box for the user.

If you serve the file directly from S3, then the user’s browser will determine what to do with it. In the case of images, that will most likely be showing the image in the browser.

If you route the requests through your server, then you can control how the user receives the file. You can add headers to the response that tell the browser that they should prompt the user to save the file instead of trying to display it.

See this guide in the PHP documentation on how to force a file download box: http://php.net/manual/en/function.readfile.php

I would recommend not using this approach, and having the files linked directly to S3, to keep the user in control of what they do with a file. Particularly in the age of mobile, if a user is on an iPhone or an iPad, which don’t have a concept of a filesystem, the “download” functionality doesn’t make as much sense as opening the image in the same window and allowing the user to utilize native controls to save the image to Photos, or email it, or AirDrop, or what have you.