Multiple File Download in ASP.NET

Discussion in 'ASP .Net' started by =?Utf-8?B?dml2ZWs=?=, May 23, 2006.

  1. Hi All,

    I want to download two or more file to user machine.
    Any one have idea.. How to download multiple file in user machine.

    When I tried to download two file using below code.
    I am not able to do...plz advise...............

    Response.ContentType = "application/vnd.msword";
    Response.AddHeader("content-disposition", "attachment;filename=" +
    "Download_View.doc");

    byte[] l_bytBinaryData;
    string l_strBase64string = GetBase64String("C:\\Download_View.doc");
    l_bytBinaryData = System.Convert.FromBase64String(l_strBase64string);
    Response.BinaryWrite(l_bytBinaryData);

    I used this two time, but this does not work and download one file.
    Can anyone tell me.. how to proceed.
    =?Utf-8?B?dml2ZWs=?=, May 23, 2006
    #1
    1. Advertising

  2. You can only return 1 stream of data, be it text (html) or binary (files).
    You can't return 2 streams within a single request/response.

    In my opinion, your best bet is to zip the 2+ files together using something
    like SharpZipLib (free, http://www.icsharpcode.net/OpenSource/SharpZipLib/)
    and returning the zip.

    Karl

    --
    http://www.openmymind.net/



    "vivek" <> wrote in message
    news:...
    >
    > Hi All,
    >
    > I want to download two or more file to user machine.
    > Any one have idea.. How to download multiple file in user machine.
    >
    > When I tried to download two file using below code.
    > I am not able to do...plz advise...............
    >
    > Response.ContentType = "application/vnd.msword";
    > Response.AddHeader("content-disposition", "attachment;filename=" +
    > "Download_View.doc");
    >
    > byte[] l_bytBinaryData;
    > string l_strBase64string = GetBase64String("C:\\Download_View.doc");
    > l_bytBinaryData = System.Convert.FromBase64String(l_strBase64string);
    > Response.BinaryWrite(l_bytBinaryData);
    >
    > I used this two time, but this does not work and download one file.
    > Can anyone tell me.. how to proceed.
    >
    >
    Karl Seguin [MVP], May 23, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Taylor
    Replies:
    2
    Views:
    925
    Ryan Taylor
    Nov 10, 2004
  2. Steve C. Orr [MVP, MCSD]
    Replies:
    0
    Views:
    1,593
    Steve C. Orr [MVP, MCSD]
    Mar 7, 2005
  3. Sam --
    Replies:
    2
    Views:
    597
    Sam --
    Mar 17, 2005
  4. Brett  Kelly
    Replies:
    1
    Views:
    667
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
  5. Niranjan
    Replies:
    0
    Views:
    309
    Niranjan
    May 21, 2004
Loading...

Share This Page