| 
 | 
 
My database field "multiple attachment upload address" has the form: 
A: / aaa; B: / bbb; C: / ccc; 
What to do when downloading? 
 
 public string FormatString (string str) 
    { 
        str = str.Replace ("", "" ";; 
        str = str.Replace ("<", "<"); 
        str = str.Replace (">", ">"); 
        str = str.Replace ('\n'.ToString (), "<br>"); 
        return str; 
    } 
    protected void Button1_Click (object sender, EventArgs e) 
    { 
        if (Request ["id"]! = null) 
        { 
            int id = Convert.ToInt32 (Request ["id"]); // Convert to a number to prevent SQL injection 
 
            SqlConnection conn = new SqlConnection (ConfigurationManager.ConnectionStrings ["SQLCONNECTIONSTRING"]. ConnectionString); 
            conn.Open (); 
            adr = "select attachment upload address from Mail WHERE mail number =" + id; 
            SqlCommand cmd = new SqlCommand (adr, conn); 
            string path = cmd.ExecuteScalar (). ToString (); 
            // Get the path 
            filepath = FormatString (path.ToString ()). ToString (). Trim (); 
 
            string Temp_filename = FormatString (path.ToString ()). ToString (); 
            int pos = Temp_filename.LastIndexOf ("\\") + 1; 
            filename = Temp_filename.Substring (pos, Temp_filename.Length-pos) .ToString (); 
            filename = HttpUtility.UrlEncode (System.Text.Encoding.UTF8.GetBytes (filename)); 
 
            Response.Clear (); 
            Response.ClearHeaders (); 
            Response.ClearContent (); 
            FileStream fs = new FileStream (filepath, FileMode.Open); 
            long FileSize = fs.Length; 
            byte [] Buffer = new byte [(int) FileSize]; 
            fs.Read (Buffer, 0, (int) fs.Length); 
            fs.Close (); 
            Response.ContentType = "application / octe-stream"; 
            Response.AddHeader ("content-disposition", "attachment; filename =" + filename); 
            Response.Charset = "UTF-8"; 
            Response.ContentEncoding = System.Text.Encoding.UTF8; 
            Response.BinaryWrite (Buffer); 
            conn.Close (); 
        } 
    } 
 
I can only download a single attachment in the form of: A: / aaa, how can I change it? 
Thanks to the respondent ~~ |   
 
 
 
 |