- Learning Cmfive
- Creating A Config
- Install And Migrations
- The Models Folder
- Creating Index Action
- Creating Index Template
- Creating Item Action
- Add Item Table
- Edit Item Button
- Additional Configuration
Cmfive supports two different types of file adapters for uploads to best suit your needs.
- The Local Adapter is enabled by default and requires no further setup.
- The S3 Adapter provides a more available and reliable solution.
- Add the following entries into the config.php file in the root directory of your Cmfive project.
Config::set("file.adapters.local.active", false); Config::set("file.adapters.s3", [ "active" => true, "region" => "S3_BUCKET_REGION", "version" => "2006-03-01", "credentials" => [ "key" => "IAM_KEY", "secret" => "IAM_SECRET", ], "bucket" => "S3_BUCKET_NAME", "options" => [ "directory" => "uploads", "create" => true ], ]);
- If you’re developing on Cmfive locally, also add the following. Note, when system.environment is set to production must be used to authenticate with AWS as this is best practice for security.
Config::set("file.adapters.s3.credentials", [ "key" => "IAM_KEY", "secret" => "IAM_SECRET", ]); Config::set("system.environment", "development");
- Replace S3_BUCKET_REGION, IAM_KEY, IAM_SECRET and S3_BUCKET_NAME with their respective values as well as IAM_KEY and IAM_SECRET if system.environment is set to development.
- Make sure to clear your config cache to apply your changes.
- If you have any files stored locally from prior to using the S3 Adapter you can run file transfer tool in the admin module from within Cmfive to move them to S3.