Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Joining files in asp download

Reply
Thread Tools

Joining files in asp download

 
 
Edgar Vigdal
Guest
Posts: n/a
 
      08-21-2004
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??





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Direct Download Movies - No Download Limits - Download DivX DVDMovies hussain dandan Python 0 12-06-2009 04:52 AM
Joining Files DTDoyle Firefox 1 10-17-2005 02:48 AM
HELP: Joining 5 large text files Stuart Perl 3 08-19-2004 06:23 PM
joining files redneck Computer Support 11 01-20-2004 07:22 AM
joining two avseq.dat files visu Computer Support 2 10-04-2003 07:05 PM



Advertisments