Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Uploadify: Moving existing files to Amazon S3 storage


Go to End


3 Posts   1962 Views

Avatar
Ryan M.

Community Member, 309 Posts

11 September 2010 at 2:58am

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?

Avatar
otherjohn

Community Member, 125 Posts

11 September 2010 at 3:22pm

FYI-if your uploadify is attached to the DataObjectManager, its not ready for the S3. Cheese said it will be updated soon though.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 September 2010 at 1:35am

Hi, Ryan,

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.