Question

I've been looking around for this a bit, and it seems like it would be relatively easy in Drupal 7, since D7 supports stream wrappers, and Fields are part of core... but I can't find any documentation.

I have a file field with a few thousand files attached to nodes, and it's using public:// right now.

I also have the AmazonS3 module installed, and some other file fields are already set to use the s3:// stream wrapper.

I now want to migrate the file field using public:// to s3://, and I want all the files already uploaded to the site's files folder to switch to s3. I can manually copy over the files to a bucket on S3, but what exactly would I need to do in Drupal/the database to get the files to be loaded over s3 instead of public?

I thought about just writing a custom query to update all rows in the file_managed table with public://custom/path to change to s3://custom/path, but (a) there are some older files that were migrated with different paths than custom/path, and (b) I'm not sure if this is the right way to get Drupal to use S3.

[Edit: Just noticed the file_move() function in the API—would I be able to move files using this (after switching the field storage in the Field UI) instead of having to manually copy files and update the database?].

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top