I am using AjaxFileUpload control in Ajaxcontrol Toolkit.
Sample code is as below.
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" ThrobberID="myThrobber"
AllowedFileTypes="doc,jpg,jpeg,mp3" MaximumNumberOfFiles="10" runat="server"
OnUploadComplete="AjaxFileUpload1_UploadComplete"
Width="450px" />
<asp:Button ID="btnCheckFiles" Text="CheckFiles" runat="server"/>
I can save the files in AjaxFileUpload1_UploadComplete event
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
AjaxFileUpload1.SaveAs(filepath);
}
Above is working fine but instead of saving files in UploadComplete event, I want to save them in Button Click event of another button after files are uploaded, here say in click event of btnCheckFiles, something like below
protected void btnCheckFiles_Click(object sender, EventArgs e)
{
// Iterate all files here uploaded
// for each file in ajaxfileupload control
//iterate and save each file to a path
}
Is there some way to achieve the above requirement?
Make changes in your aspx page as follow:
Add javascript block as follow:
In your .cs page