Upload files to final destination after user selects them

2 posts, 0 answers
  1. RB
    RB avatar
    126 posts
    Member since:
    Dec 2013

    Posted 14 Aug 2014 Link to this post

    When the user selects a file in the RadAsyncUpload Control, instead of saving files to final destination on click of an Upload button, I want the files to be saved automatically on selection of the files. Some validations are made and then files are saved to final destination. I have seen examples where there is an Upload button which saves files to the final destination, but this is not what I want. Please let me know how to do this.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Aug 2014 in reply to RB Link to this post

    Hi RB,

    Please try the below code snippet to achieve your scenario.

    ASPX:
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" TargetFolder="Uploads"
        OnClientFileUploaded="saveToTargetFolder">
    </telerik:RadAsyncUpload>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    </telerik:RadAjaxManager>

    JavaScript:
    function saveToTargetFolder(sender, args) {
        $find("<%=RadAjaxManager1.ClientID%>").ajaxRequest();
    }

    C#:
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
        string targetPath = string.Empty;
        targetPath = Path.Combine(Server.MapPath(RadAsyncUpload1.TargetFolder));
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top