Using Multiple Accounts for One Cloud Storage Provider

In some scenarios it is needed to upload files in multiple accounts or containers (buckets) for one storage provider. This would require a special configuration. With the default RadCloudUpload configuration it is possible to have only one Cloud Storage Provider per type in the configuration file. For example you could have only one Amazon, Azure or Telerik Backend Services (formerly Everlive) configurations in the web.config file. The steps below show how to upload in multiple containers for one provider.

All providers configuration is stored in the configuration files. It is not allowed to define provider's configuration in the markup of the control or through the code behind. This is because the configuration contains sensitive data (access key, secret key and etc.). By using it in that way it will not be passed from server to the client. At the sametime it will be accessible from the cloud upload's handler, where the actual uploading happens.

Configure RadCloudUpload to use multiple accounts or containers for one Cloud Storage Provider

  1. Change the allow definition for the RadCloudUpload section in the web.config of the root folder to "Everywhere":


    <?xml version="1.0"?>
            <sectionGroup name="telerik.web.ui">
                <section name="radCloudUpload" type="Telerik.Web.UI.CloudUploadConfigurationSection" allowDefinition="Everywhere" requirePermission="false"/>
  2. Create a new folder

  3. Add new Web form

  4. Add new Custom Handler

  5. Add new configuration file
    cloud-upload-multiple 1

  6. Configure the web.config in the newly added folder:


    <?xml version="1.0" ?>
                <!--Remove the existing provider from the web.config of the root folder.
                If it is not set then the next row is not needed.-->
                <remove name="Amazon"/>
                <add name="Amazon" type="Telerik.Web.UI.AmazonS3Provider" accessKey="" secretKey="" bucketName="" subFolderStructure="" uncommitedFilesExpirationPeriod="2" />
  7. Configure the Custom Handler:


    <%@ WebHandler Language="C#" Class="Handler" %>
    using System;
    using System.Web;
    using Telerik.Web.UI;
    public class Handler : CloudUploadHandler


    <%@ WebHandler Language="VB" Class="Handler" %>
    Imports System
    Imports System.Web
    Imports Telerik.Web.UI
    Public Class Handler : Inherits CloudUploadHandler
    End Class
  8. Add RadCloudUpload control to the form and configure it to use the added custom handler:


    <telerik:RadCloudUpload ID="RadCloudUpload2" runat="server" ProviderType="Amazon" HttpHandlerUrl="~/AmazonS3Bucket1/Handler.ashx">

See Also

In this article
Not finding the help you need? Improve this article