Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

AsyncFileUpload

$
0
0

Hi just want to upload files using the ajax control

The folder I am storering files is "Feuillets"

Can someone help me about how to store files into this folder

public partial class FileUpload : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
//AsyncFileUpload1.UploaderStyle = AjaxControlToolkit.AsyncFileUpload.UploaderStyleEnum.Modern;
AsyncFileUpload1.UploadedComplete += new EventHandler<AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedComplete);
AsyncFileUpload1.UploadedFileError += new EventHandler<AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError);
}

void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "size", "top.$get(\"" + uploadResult.ClientID + "\").innerHTML = 'Uploaded size: " + AsyncFileUpload1.FileBytes.Length.ToString() + "';", true);

// Uncomment to save to AsyncFileUpload\Uploads folder.
// ASP.NET must have the necessary permissions to write to the file system.

 string savePath = MapPath("~/Feuillets/");
 AsyncFileUpload1.SaveAs(savePath);
}

void AsyncFileUpload1_UploadedFileError(object sender, AsyncFileUploadEventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "error", "top.$get(\"" + uploadResult.ClientID + "\").innerHTML = 'Error: " + e.StatusMessage + "';", true);
}
}


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>