Save uploaded file count using ASP.Net AjaxFileUpload control in C# and VB.Net

Last Reply one year ago By pandeyism

Posted one year ago

Hi All ,

I am using ajaxfileupload for multiple files and i want to save the count of each files uplaod.

Suppose file 1 upload count =1

file 2 Count =2 upto 5 files i have set limit.

I need to save the file count in every excel. Suppose one excel upload

In database there will be FileCount Column and for excel 1, 1 should saved.

<asp:AjaxFileUpload ID="AjaxFileUploadAdvanceAdjusted" runat="server" Width="850px" AllowedFileTypes="xlsx,xls" MaxFileSize="10000" MaximumNumberOfFiles="5" OnUploadComplete="AjaxFileUpload_UploadComplete" />


protected void AjaxFileUpload1_UploadComplete(object sender, AjaxFileUploadEventArgs e)
    dt2 = new DataTable();
        string filename = Path.GetFileName(e.FileName);
        string FolderPath = "~/MyFiles/Files/";
        string filepath = Server.MapPath(FolderPath + filename);

        //To set dafault coloumn in datatable and save in datatabase.

        //Foreach to add in every row in datatable.
        foreach (DataRow row in dtExcelData.Rows)
            row["Cell"] = Session["ClientName"].ToString(); 
            row["FileCount1"] = ???

        //Bulkinsert method to insert data in sql.
        InsDataInSql("File1", "abcFile1");

Please help.

This question does not have replies that have been liked.