Wednesday, June 27, 2012

Multiple FileUploading using Jquery:

 Multiple FileUploading using Jquery:


Add  Below Two  Jquery file to ur Solution
1. jquery-1.3.2.js.
2.jquery.MultiFile.js .


Aspx page Code:






        Text="Button" onclick="Button1_Click" />
    Upload Multiple Files in ASP.NET Using jQuery
       
       

   
   
       

.Cs Code:

 protected void Button1_Click(object sender, EventArgs e)
    {
         try
        {
            
            HttpFileCollection hfc = Request.Files;
            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf = hfc[i];
                if (hpf.ContentLength > 0)
                {
                    hpf.SaveAs(Server.MapPath("MyFiles") + "\\" +
                      System.IO.Path.GetFileName(hpf.FileName));
                    Response.Write("File: " + hpf.FileName + " Size: " +
                        hpf.ContentLength + " Type: " + hpf.ContentType + " Uploaded Successfully");
                }
            }
        }
        catch (Exception ex)
        {
           
        }
    }





No comments:

Post a Comment