Documentation

Storage

Better CMS supports local, FTP, Azure Cloud and Amazon S3 Cloud file storage. Any one of them can be used with the example configuration. Migration of files from one storage to another automatically is not possible at this time. On the other hand, a custom storage engine can be created and is compatible with Better CMS.

Please pay attention to which URLs ends with "/" symbol.

Note: In all the cases, the parameter contentRootUrl must be publicly available to show images that have been inserted into CMS pages.

Local Storage:

<storage serviceType="FileSystem" contentRoot="~/uploads/" contentRootUrl="~/uploads" />

FTP:

<storage serviceType="Ftp" contentRoot="ftp://somewhere.net/uploads" contentRootUrl="http://somewhere.net/uploads">
  <add key="FtpRoot" value="ftp://somewhere.net/uploads" />
  <add key="FtpUserName" value="[someUserName]" />
  <add key="FtpPassword" value="[somePassword]" />
  <add key="UsePassiveMode" value="false" />
</storage>

Amazon S3:

Install the Amazon S3 module with the package manager command: install-package BetterCms.Module.AmazonS3Storage.

Note: BetterCms.Module.WindowsAzureStorage should be removed from the project.

<storage serviceType="Auto" contentRoot="https://[amazonBucketName].s3.amazonaws.com/[amazonBucketFolder]/" contentRootUrl="http://d3ps349ugxl1cb.cloudfront.net/amazonBucketFolder/" processTimeout="00:05:00">
    <add key="AmazonAccessKey" value="[amazonAccessKey]" />
    <add key="AmazonSecretKey" value="[amazonSecretKey]" />
    <add key="AmazonBucketName" value="[amazonBucketName]" />
    <add key="AmazonTokenExpiryTime" value="00:01:00" />
  </storage>

AmazonTokenExpiryTime is only used when accessControlEnabled is enabled in the security section. This indicates how much time URLs with security tokens are enabled.

processTimeout determines the maximum execution time of upload and download requests.

Azure:

Install the Azure module with the package manager command: install-package BetterCms.Module.WindowsAzureStorage.

Note: BetterCms.Module.AmazonS3Storage should be removed from the project. Note: Azure container names cannot contain underscores (_).

<storage serviceType="Auto" contentRoot="http[s]://[AzureAccountName].blob.core.windows.net/[AzureFolderName]/" processTimeout="00:05:00">
    <add key="AzureAccountName" value="[AzureAccountName]" />
    <add key="AzureSecondaryKey" value="[AzuresecretKey]" />
    <add key="AzureContainerName" value="[AzureFolderName]" />
    <add key="AzureUseHttps" value="[true/false]" />
    <add key="AzureTokenExpiryTime" value="00:01:00" />
  </storage>

AzureTokenExpiryTime is only used when accessControlEnabled is enabled in the security section. This indicates how much time URLs with security tokens are enabled. processTimeout determines the maximum execution time of upload and download requests.

Note: Azure storage cannot contain both public and private files within one container. If security for files is enabled, the files container should be set as "private" and the images container should be set as "public". If the secured container is not configured, Better CMS will use the main container.

Example configuration with secured and unsecured containers:

<storage serviceType="Auto" contentRoot="http[s]://[AzureAccountName].blob.core.windows.net/[AzureFolderName]/" securedContentRoot="http[s]://[AzureAccountName].blob.core.windows.net/[AzureSecuredFolderName]/" processTimeout="00:05:00">
    <add key="AzureAccountName" value="[AzureAccountName]" />
    <add key="AzureSecondaryKey" value="[AzuresecretKey]" />
    <add key="AzureContainerName" value="[AzureFolderName]" />
    <add key="AzureSecuredContainerName" value="[AzureSecuredFolderName]" />
    <add key="AzureUseHttps" value="[true/false]" />
    <add key="AzureTokenExpiryTime" value="00:01:00" />
</storage>

Custom:

Developers can create custom storage engines. For a custom engine to work, an implementation of BetterCms.Core.Services.Storage.IStorageService interface is required.

Example configuration for custom storage engine:

<storage serviceType="Custom" contentRoot="[path to upload files]" contentRootUrl="[path to access files publically]" processTimeout="00:30:00">
    <add key="typeName" value="BetterCms.Sandbox.Mvc4.Custom.CustomStorageServiceTest, BetterCms.Sandbox.Mvc4"/>
  </storage>