> The problem with that is that the originally uploaded filename is lost. At least without storing it in a separate database.
Sure, but that's a tradeoff nearly every website accepts because they just need the image itself. If you do want to preserve the original filename, is there a reason for not just keeping it in a database?