Setting a download filename on S3

One helpful feature of S3, and something I haven’t seen discussed, is that you can use the Content-Disposition header to control the filename of the download a user receives. This is really helpful for when you have a file on S3 named using, say, a hash of the contents. Your user probably doesn’t want a file called “e434b232c2e4f70aa2819d708dfd30fb4cebcf6c.zip” right?

Here’s an example using boto:

Pretty cool.