FileRecieved Event not getting fired in SharePoint

Jul 14, 2011 at 3:36 PM

I tried to use the control in SharePoint Custom UserControl. Registered Assembly both in Master Page and control once at a time (for trial).

I can see the upload control but the File Received event is not getting fired.

protected void ks_FileReceived(object sender, com.flajaxian.FileReceivedEventArgs e)       

protected void ks_FileReceived(object sender, com.flajaxian.FileReceivedEventArgs e)
        {
            SPSite site = SPContext.Current.Site;
            SPWeb web = site.OpenWeb();
            web.AllowUnsafeUpdates = true;
            SPDocumentLibrary doc = (SPDocumentLibrary)web.Lists["SharedDocuments"];
            SPFolder objFolder = web.Folders[ViewState["folderUrl"].ToString()];
            lblError.Text += objFolder.Url.ToString() + ":";
            if (e.File.ContentLength > 0)
            {
                System.IO.Stream strm = e.File.InputStream;

                byte[] byt = new byte[Convert.ToInt32(e.File.ContentLength)];

                strm.Read(byt, 0, Convert.ToInt32(e.File.ContentLength));
                strm.Close();
                objFolder.Files.Add(System.IO.Path.GetFileName(e.File.FileName), byt);
            }
        }

 

HTML:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Upload.aspx.cs" Inherits="Upload" %>
<%@Register Assembly="com.flajaxian.FileUploader" Namespace="com.flajaxian" TagPrefix="ks" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <ks:FileUploader ID="ks" runat="server" onfilereceived="ks_FileReceived"></ks:FileUploader>
    </div>
    </form>
</body>
</html>

Please Help