About to install the Uploadify module and use it to upload files to Amazon S3. However I already have a ton of existing files, and I'd like to move these to S3 as well. Has anyone done this before? If so, what's the procedure for updating the existing files with their new URLs?
FYI-if your uploadify is attached to the DataObjectManager, its not ready for the S3. Cheese said it will be updated soon though.
S3File is a different model from the standard SilverStripe File class, as you've probably noticed. The three key fields are:
- Name (the base filename, e.g. "some-image.jpg"
- Bucket (the S3 bucket, e.g. "my-uploaded-files")
- The URL (http://my-uploaded-files.amazonaws.com/some-image.jpg)
So a migration process might look like this:
Map File.ID to S3File.ID (assuming S3File table is empty)
Map File.Name to S3File.Name
Map File.Parent.Name to S3File.Bucket
Once that's all in place, run an update to the S3 table to create URL fields that represent a concatenation of [url=http://[Bucket].amazonaws.com/]http://[Bucket].amazonaws.com/[Name]
Then, update all your models to point to S3File instead of "File"..
You'll probably have to massage the data a bit, but you get the idea.