Download File

Discussion in 'ASP .Net' started by Skwish, Dec 10, 2003.

  1. Skwish

    Skwish Guest

    Hi,

    I have been using

    Dim filename As String
    Dim filepath As String

    filename = "Steve.txt"
    filepath = Server.MapPath(".") & "\" & filename
    Response.Clear()
    Response.ContentType = "application/octet-stream"
    Response.AddHeader("Content-Disposition", "attachment; filename=" &
    filename )
    Response.WriteFile(filepath)
    Response.End()

    To download a single file from server to client. However, I would like to
    move an entire folder of files and I have been unsuccessful. If I use the
    above inside a loop for each file in the folder, I end up with a single file
    on the client (all the files put into one with the first file's name).

    Can someone help please? Also, what is the Response.AddFileDependencies
    method do? There is no good documentation and it would seem that it might
    be useful in my problem.

    Thanks,

    Stephen
    Skwish, Dec 10, 2003
    #1
    1. Advertising

  2. Skwish

    Jerron Guest

    you need to use mutipart MIME to separate each files, like following:

    Content-Type: multipart/mixed;
    boundary="----_=_NextPart_001_01C3BE96.0ABC9C61"

    "Skwish" <> wrote in message
    news:...
    > Hi,
    >
    > I have been using
    >
    > Dim filename As String
    > Dim filepath As String
    >
    > filename = "Steve.txt"
    > filepath = Server.MapPath(".") & "\" & filename
    > Response.Clear()
    > Response.ContentType = "application/octet-stream"
    > Response.AddHeader("Content-Disposition", "attachment; filename=" &
    > filename )
    > Response.WriteFile(filepath)
    > Response.End()
    >
    > To download a single file from server to client. However, I would like to
    > move an entire folder of files and I have been unsuccessful. If I use the
    > above inside a loop for each file in the folder, I end up with a single

    file
    > on the client (all the files put into one with the first file's name).
    >
    > Can someone help please? Also, what is the Response.AddFileDependencies
    > method do? There is no good documentation and it would seem that it might
    > be useful in my problem.
    >
    > Thanks,
    >
    > Stephen
    >
    >
    >
    Jerron, Dec 10, 2003
    #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:
    913
    Ryan Taylor
    Nov 10, 2004
  2. Steve C. Orr [MVP, MCSD]
    Replies:
    0
    Views:
    1,578
    Steve C. Orr [MVP, MCSD]
    Mar 7, 2005
  3. Sam --
    Replies:
    2
    Views:
    584
    Sam --
    Mar 17, 2005
  4. Rafal Majda
    Replies:
    5
    Views:
    2,220
    Rafal Majda
    Apr 18, 2005
  5. Brett  Kelly
    Replies:
    1
    Views:
    652
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
Loading...

Share This Page