RM 2.2 Storing files in S3 with their original name and extension


New member

My community is currently storing our resources in S3 via:

However, we need to change how the files themselves are stored in the bucket.

We basically want our S3 bucket to double as a CDN, and as such we want to be able to store certain file extensions (.bsp and .bsp.bz2) to a specific location and to not have the file renamed as it is stored.

Instead of storing a file as
We would like it to be

These files are generally on the order of 10's of megabytes and we have hundreds of thousands of these. As it is today, we have to move these files around a lot and redownload the files with their original names to service our community. Getting S3 to double as a CDN for these files will reduce our bandwidth cost and storage costs by over 50%.

I'm comfortable writing code for this, I've been a developer for over 10 years, but haven't done anything with PHP or Xenforo before. If someone could point me in the right direction for doing this that would be very helpful. I assume the storage format is as it is today to avoid file name conflicts, we are fine with rejecting any files with a name collision.