Joining files in asp download

Discussion in 'ASP General' started by Edgar Vigdal, Aug 21, 2004.

  1. Edgar Vigdal

    Edgar Vigdal Guest

    Hi!

    I'm trying to make a script that will download first one file (the main
    file) and then download some extra data in the same stream.

    1=file 1
    2=file 2

    111111111111111111111111111111111111+222

    here is what I use today...


    Server.ScriptTimeout = 900

    '----- get full path of specified file
    strFilename = server.MapPath(strFile)
    newFilename = Request("file")
    addon=Session("test")

    '----- clear the buffer
    Response.Buffer = True
    Response.Clear

    '----- create stream
    Set s = Server.CreateObject("ADODB.Stream")
    s.Open

    '----- set as binary
    s.Type = 1

    '----- load in the file
    on error resume next


    '----- check the file exists
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    if not fso.FileExists(strFilename) then
    Response.Write("<h1>Error:</h1>File does not exist<p>")
    Response.End
    end if


    '----- get length of file
    Set f = fso.GetFile(strFilename)
    intFilelength = f.size + len(addon)


    s.LoadFromFile(strFilename)
    if err then
    Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
    Response.End
    end if

    '----- send the headers to the users browser
    Response.AddHeader "Content-Disposition", "attachment; filename=" &
    newFilename
    Response.AddHeader "Content-Length", intFilelength
    Response.Charset = "UTF-8"
    Response.ContentType = "application/x-msdownload"

    '----- output part 1 (the file) to the browser
    Response.BinaryWrite s.Read
    if Response.Buffer then
    Response.flush
    end if

    '----- output part 2 (extra) to the browser
    Response.BinaryWrite addon
    if Response.Buffer then
    Response.flush
    end if

    '----- tidy up
    s.Close
    Set s = Nothing




    This is working on my Windows2000 with explorer 6, but not on my friends
    winXP with explorer 6. He only gets the first part!
    Anyone that can help me with this??
     
    Edgar Vigdal, Aug 21, 2004
    #1
    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. Stuart
    Replies:
    3
    Views:
    451
    Joe Smith
    Aug 19, 2004
  2. JHenstay
    Replies:
    3
    Views:
    551
    osmium
    Jan 11, 2004
  3. mosscliffe

    Joining Big Files

    mosscliffe, Aug 25, 2007, in forum: Python
    Replies:
    7
    Views:
    449
    vasudevram
    Aug 31, 2007
  4. Joseph J. Kesselman

    Re: Joining XML files?

    Joseph J. Kesselman, Jul 1, 2008, in forum: XML
    Replies:
    0
    Views:
    563
    Joseph J. Kesselman
    Jul 1, 2008
  5. Hermann Peifer

    Re: Joining XML files?

    Hermann Peifer, Jul 6, 2008, in forum: XML
    Replies:
    0
    Views:
    697
    Hermann Peifer
    Jul 6, 2008
Loading...

Share This Page