Skip to content

How to create a dynamic fileupload on clicking add and remov

Vignesh Vaidyanathan

Asked May 23, 2014, 2:35 AM EDT2 answers
Share
LinkedInX

For example

1) A file upload control is available already

2) If the user clicks on (+) button a new fil upload control is added dynamically.

3) If the user clicls (-) button the newly added file upload control will be removed.

4) In this way if the user clicks on the upload button all the files must be uploaded together to a folder

How this is possible pls help me

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    You need to add One Panel control in Webpage and After That


    For Add :-


    FileUpload fl = new FileUpload();
    Panel1.Controls.add(fl);



    For Remove 
    Panel1.Controls.RemoveAt(index);


    For get FileUpload Values
    Code
     for(int i=0;i<Panel1.Controls.Count;i++)
                {
                    FileUpload fl = (FileUpload)P.Controls[i];
                    fl.PostedFile.SaveAs("YourPath");
                }
    0