I was just having the same problem. All the examples I saw online did not work for me either. After stripping down the code, I figured I had to use ToolKitScriptManager and not the standard asp:ScriptManager.
I have not use the the toolkit before so I don't know if this is a new requirement with the latest toolkit since all the older examples I read used the ScriptManager and said it is supposed to work fine.
Here is the code behind to save from a button click:
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
AjaxControlToolkit.AsyncFileUpload afu = (AjaxControlToolkit.AsyncFileUpload)sender;
if (afu.HasFile)
{
Session["AsyncFileUploadImage"] = afu;
}
}
protected void AsyncFileUpload1_UploadedFileError(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
...
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (Session["AsyncFileUploadImage"] != null)
{
this.AsyncFileUpload1 = (AjaxControlToolkit.AsyncFileUpload)Session["AsyncFileUploadImage"];
this.AsyncFileUpload1.SaveAs(Path.Combine(Request.PhysicalApplicationPath,"images", "uploads", this.AsyncFileUpload1.FileName)); //make sure to save in directory with write permissions
this.lblStatus.Text = "You uploaded " + AsyncFileUpload1.FileName;
}
else
{
...
}
}