Click here to Skip to main content
14,331,992 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to upload multiple files.. if user may upload 1 file then they may b go with submit button but if user wants to upload multiples files then they should click on upload more files and then next fileupload will be display how i do this.. i want to upload file separtely .. not want to select multiples at a time this is what i try

What I have tried:

 <div>


        <asp:FileUpload ID="FileUpload1" runat="server" />
        <asp:LinkButton ID="LinkButton1" runat="server">upload multiple files</asp:LinkButton>
   
    <br />
    <asp:Button ID="Button1" runat="server" Text="upload" OnClick="Button1_Click" />
    <br />
    <asp:Label ID="Span1" runat="server"></asp:Label>
</div>



protected void Button1_Click(object sender, EventArgs e)
       {
           if (FileUpload1.HasFiles)
           {
               foreach (HttpPostedFile uploadedFile in FileUpload1.PostedFiles)
               {
                   uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"),
                   uploadedFile.FileName));
                   Span1.Text += String.Format("{0}<br />", uploadedFile.FileName);
               }
           }
Posted
Updated 22-Dec-16 22:09pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
super_user 23-Dec-16 5:05am
   
they are using javascript and i dont want to use javascript or jquery .. . want to do this with only .net c#
super_user 23-Dec-16 5:06am
   
this is using script or jquery.. i dont want to use this . use only c# ,net
super_user 23-Dec-16 5:17am
   
........
super_user 24-Dec-16 15:57pm
   
i dont want this.. i said i dont want multiple files selection at a time.. i want to select individual files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100