473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Joining files in asp download

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??

Jul 19 '05 #1
0 1163

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Swede | last post by:
Hello, I am posting this rather lengthy description here in hope of getting at least some insight into a problem that is really hurting my business, since I have come to the conclusion that my...
6
by: benji | last post by:
I have set up a system to download datafeeds in pain text or zipped. The download part of this system uses the curl extension to download the files. All was well when I tested it with various...
0
by: Mark | last post by:
Hi all, I have 2 files containing Id numbers and surnames (these files essentially contain the same data) I want to select distinct() and join on id number to return a recordset containing every...
9
by: Eric Sabine | last post by:
Can someone give me a practical example of why I would join threads? I am assuming that you would typically join a background thread with the UI thread and not a background to a background, but...
5
by: Stanav | last post by:
Hello all, Thanks in advance for any replies... Now, my question is: Is it possible to do a multiple files download for a single response event on an aspx page? If there is, please give me some...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
2
by: Good Man | last post by:
Hi there folks I've got an interesting little problem going on. On one of my projects, I have users log in to retrieve files. The files themselves are stored outside of the www directory on...
5
by: Paul Czubilinski | last post by:
Hello, I would like to join few pdf files uploaded separetly into my website into one downloable pdf file. Is it possible in php or is it neccessary to download all these files one by one? ...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.