E
Edgar Vigdal
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??
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??