This is a migrated thread and some comments may be shown as answers.

Upload files to final destination after user selects them

1 Answer 18 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 14 Aug 2014, 10:06 PM
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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 18 Aug 2014, 12:28 PM
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.
Tags
AsyncUpload
Asked by
RB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or