creating IsPosting eventhandler

May 6, 2009 at 3:48 PM
Hi everybody,

I wonder if it is possible to make changes on the ajax fileupload library by creating an eventhqndler IsPosting instead of a boolean property.
just now the solution to managing the HttpPostedFileAJAX is :

protected void Page_Load(object sender, EventArgs e)
{
   if (FileUploaderAJAX1.IsPosting)
      this.managePost();
}

private void managePost()
{
   HttpPostedFileAJAX pf = FileUploaderAJAX1.PostedFile;

   if ((pf.Type == HttpPostedFileAJAX.fileType.image) && pf.ContentLength <= 5 * 1024)
      FileUploaderAJAX1.SaveAs("~/temp", pf.FileName);
}

i want that it would be like this :

protected void Page_Load(object sender, EventArgs e)
{
   FileUploaderAJAX1.Posting+=new EventHandler(FileUploaderAJAX_Posting);
}

protected void FileUploaderAJAX_Posting(object sender, EventArgs e)
{
  HttpPostedFileAJAX pf = FileUploaderAJAX.PostedFile;
  FileUploaderAJAX.SaveAs("/Sessions/", pf.FileName);
}

thank you in advance.