Unplanned
Last Updated: 09 Jan 2020 09:05 by ADMIN
Telerik Admin
Created on: 09 Jan 2020 09:04
Category: CloudUpload
Type: Feature Request
2
ADD: Query Strings Parameters passed to the Handler of the RadCloudUpload

Add a functionality, which allows developers to pass query string parameters from client to the custom handler. Similar to RadAsyncUpload.

Workaround:

<telerik:RadCloudUpload ID="RadCloudUpload1" runat="server" ProviderType="Azure"
            MultipleFileSelection="Automatic" OnClientFileSelected="onClientFileSelected"
            HttpHandlerUrl="~/Handlers/UploadToMultipleFoldersHandler.ashx">
</telerik:RadCloudUpload>

<script>
    function onClientFileSelected(sender, args) {
        var customParam = "test";
        sender._module._handlerUrl = "/Handlers/UploadToMultipleFoldersHandler.ashx?type=rcu&customParam=" + customParam;
    }
</script>

<%@ WebHandler Language="C#" Class="UploadToMultipleFoldersHandler" %>
  
using System;
using System.Web;
  
public class UploadToMultipleFoldersHandler : Telerik.Web.UI.CloudUploadHandler {
  
    public override void SetKeyName(object sender, Telerik.Web.UI.CloudUpload.SetKeyNameEventArgs e)
    {
        var param = HttpContext.Current.Request["customParam"];
               
        var carsFolder = HttpContext.Current.User.Identity.Name + "/";
        e.KeyName = string.Format("{0}{1}_{2}", carsFolder, Guid.NewGuid(), e.OriginalFileName);
    }  
}

0 comments