Hey guys,
in my website the user uploads 3 random files. I've uploaded these in a folder on my machine using the FIleUpload Control. But now i want to give a link to the user to download the uploaded files.
This is what i've done so far:

HyperLink link1 = (HyperLink)DetailsView1.FindControl("HyperLink1");
        HyperLink link2 = (HyperLink)DetailsView1.FindControl("HyperLink2");
        HyperLink link3 = (HyperLink)DetailsView1.FindControl("HyperLink3");
        
        string temp_link = "C:\temp\\";
        string link_query = "SELECT attachment FROM booking_projdetails WHERE emp_bookid='" + getid.Text + "' ";
        SqlCommand link_cmd = new SqlCommand(link_query, myConnection);
        SqlDataReader link_rdr;
        link_rdr = link_cmd.ExecuteReader();
        while (link_rdr.Read())
        {
            int b=0;
            string link_text = link_rdr[0].ToString();
            string[] filesplit = link_text.Split(',');

            string file = "";
            int i = 0;
          foreach (string p in filesplit)
            {

                    if (filesplit[i]!= "" && i<3)
                    {
                        //temp_link += p;
                        if (i == 0)
                        {
                            
                            link1.Text = filesplit[0];
                            link1.NavigateUrl = temp_link + filesplit[0];
                        }
                        else if(i==1)
                        {
                            link2.Text = filesplit[1];
                            link2.NavigateUrl = temp_link + filesplit[1];

                        }
                        else if (i == 2)
                        {

                            link3.Text = filesplit[2];
                                link3.NavigateUrl = temp_link + filesplit[2];

                            
                        }
                        i++;

                    }
                    else
                    {
                        break;
                    }

                }
            }

Please give a solution.

Recommended Answers

All 2 Replies

using your website url and the relative paths to the files from your webroot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.