Hi all, Iam using file upload control in my application where user can upload single as well as multiple files & make sure file is uploaded with unique name.

Also once uploaded to be able to view files in a dropdown & have a download button so selecting any file from the dropdown,user can download the file as well.

Thanks In Advance!
Steve

try like this

<table>
    <tr>
    <td>
      <asp:FileUpload ID="fileup1" runat="server" />
    </td>
    </tr>
    <tr>
    <td>
    <asp:Button ID="btnsubmit" runat="server" Text="Submit" OnClick="btnsubmit_Click"   />
    </td>
    </tr>
        <td>
      <asp:DropDownList ID="ddlist" runat="server"></asp:DropDownList>
    </td>
    
    </tr>
    <tr>
    <td>
    <asp:Button ID="btndownload" runat="server" Text="Download" OnClick="btndownload_Click" />
    </td>
    </tr>
  
    </table>
in code:
   protected void btnsubmit_Click(object sender, EventArgs e)
    {
        btnsubmit.Font.Bold = true;
        if (fileup1.HasFile)
        {
           
                        string dirpath = Server.MapPath("~\\Photos\\") + System.IO.Path.GetFileName(fileup1.PostedFile.FileName);//create a folder by name photos
              fileup1.PostedFile.SaveAs(dirpath);
              ddlist.Items.Add(System.IO.Path.GetFileName(fileup1.PostedFile.FileName));
         
       
            
        }

    }
    protected void btndownload_Click(object sender, EventArgs e)
    {
       Response.Redirect( Server.MapPath("~\\Photos\\") + ddlist.SelectedItem.Text);
       

    }
This article has been dead for over six months. Start a new discussion instead.