The database is loaded with files from Amazon S3 now, and the app is all set to send the media back to the requestor by filename! It's just a few lines of code to get there, so it should be simple, right?
Yes and no.
It won't take much to get the files delivered by filename from the URL, but there's a few more things that need to be in place for this to happen properly. For example, how do ensure there is only one file in the database with a given file name? And what's the best way to handle loading the file object from the database while keeping your router handlers nice and clean?
In this episode, you'll see the finishing touches on the first part of the media service – retrieving a file from the database, by filename, based on a requested URL.