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.

using ASP to zip up file for downloading?

I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.

Is thier an easy way to use asp to zip of the file and then the user can
download the file?

My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the user
when the user exits the page, so that they don't fill my hard drive.

Thanks
Jul 22 '05 #1
5 7120
1. Why do you have to zip a text file? Is it large? The person can
download a text file just fine. If you are trying to get around the fact
that many people wouldn't know to right click the link and do a "Save target
as..." (or other for other browsers) and want to encourage the download,
take a look here. http://www.aspfaq.com/show.asp?id=2161

If you decide you still want to zip the file, look here.
http://www.aspfaq.com/show.asp?id=2187

As for your other question, no. The server doesn't know when someone closes
his browser. Perhaps what you should do, should you decide not to zip the
text file, is do:

(Adapted from link above)
<%
Response.ContentType = "application/Andrew's Product Key" ' arbitrary
fn = "productkey.txt"
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open
adoStream.Type = 2 ''(text instead of binary)
adoStream.WriteText "Your product key text"
adoStream.Position = 0
Response.Write adoStream.ReadText
adoStream.Close
Set adoStream = Nothing

Response.End
%>

Ray at home

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.

Is thier an easy way to use asp to zip of the file and then the user can
download the file?

My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the
user
when the user exits the page, so that they don't fill my hard drive.

Thanks

Jul 22 '05 #2
I'd rather have the people download the file as is, but when you click the
link, it just shows the contents of the file, instead of showing the download
dialog.

"Ray Costanzo [MVP]" wrote:
1. Why do you have to zip a text file? Is it large? The person can
download a text file just fine. If you are trying to get around the fact
that many people wouldn't know to right click the link and do a "Save target
as..." (or other for other browsers) and want to encourage the download,
take a look here. http://www.aspfaq.com/show.asp?id=2161

If you decide you still want to zip the file, look here.
http://www.aspfaq.com/show.asp?id=2187

As for your other question, no. The server doesn't know when someone closes
his browser. Perhaps what you should do, should you decide not to zip the
text file, is do:

(Adapted from link above)
<%
Response.ContentType = "application/Andrew's Product Key" ' arbitrary
fn = "productkey.txt"
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open
adoStream.Type = 2 ''(text instead of binary)
adoStream.WriteText "Your product key text"
adoStream.Position = 0
Response.Write adoStream.ReadText
adoStream.Close
Set adoStream = Nothing

Response.End
%>

Ray at home

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.

Is thier an easy way to use asp to zip of the file and then the user can
download the file?

My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the
user
when the user exits the page, so that they don't fill my hard drive.

Thanks


Jul 22 '05 #3
thanks that was just what I was needing... thanks again..
"Ray Costanzo [MVP]" wrote:
1. Why do you have to zip a text file? Is it large? The person can
download a text file just fine. If you are trying to get around the fact
that many people wouldn't know to right click the link and do a "Save target
as..." (or other for other browsers) and want to encourage the download,
take a look here. http://www.aspfaq.com/show.asp?id=2161

If you decide you still want to zip the file, look here.
http://www.aspfaq.com/show.asp?id=2187

As for your other question, no. The server doesn't know when someone closes
his browser. Perhaps what you should do, should you decide not to zip the
text file, is do:

(Adapted from link above)
<%
Response.ContentType = "application/Andrew's Product Key" ' arbitrary
fn = "productkey.txt"
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open
adoStream.Type = 2 ''(text instead of binary)
adoStream.WriteText "Your product key text"
adoStream.Position = 0
Response.Write adoStream.ReadText
adoStream.Close
Set adoStream = Nothing

Response.End
%>

Ray at home

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.

Is thier an easy way to use asp to zip of the file and then the user can
download the file?

My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the
user
when the user exits the page, so that they don't fill my hard drive.

Thanks


Jul 22 '05 #4
Just rename the file extension to somethign not recognizable, then it will
ask you to download.

Something like myfile.abc

"Andrew" wrote:
thanks that was just what I was needing... thanks again..
"Ray Costanzo [MVP]" wrote:
1. Why do you have to zip a text file? Is it large? The person can
download a text file just fine. If you are trying to get around the fact
that many people wouldn't know to right click the link and do a "Save target
as..." (or other for other browsers) and want to encourage the download,
take a look here. http://www.aspfaq.com/show.asp?id=2161

If you decide you still want to zip the file, look here.
http://www.aspfaq.com/show.asp?id=2187

As for your other question, no. The server doesn't know when someone closes
his browser. Perhaps what you should do, should you decide not to zip the
text file, is do:

(Adapted from link above)
<%
Response.ContentType = "application/Andrew's Product Key" ' arbitrary
fn = "productkey.txt"
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open
adoStream.Type = 2 ''(text instead of binary)
adoStream.WriteText "Your product key text"
adoStream.Position = 0
Response.Write adoStream.ReadText
adoStream.Close
Set adoStream = Nothing

Response.End
%>

Ray at home

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.

Is thier an easy way to use asp to zip of the file and then the user can
download the file?

My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the
user
when the user exits the page, so that they don't fill my hard drive.

Thanks


Jul 22 '05 #5
Depending on how technically savvy the end user is, this might not be a very
wise option. If you can force a download prompt without renaming the file
(like the article demonstrates), why not do that?

Just rename the file extension to somethign not recognizable, then it will
ask you to download.

Something like myfile.abc

Jul 22 '05 #6

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

Similar topics

10
by: scrimp | last post by:
Ive been using PAMIE 1.4 to try to automate web page processes. The one thing I cannot do with it is upload files and download files. With uploading files, the file input box does not allow PAMIE...
1
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a...
2
by: Kumar | last post by:
Hi, I am trying to develop FTP client application using c#. Our application functinality should be like this: 1.our client uploads files,folders to our ftp server for every 20 minutes. ...
3
by: Jocelyn Duhaylungsod | last post by:
I have been getting the following server errors sporadically while downloading excel, csv or xml file. Internet Explorer cannot download <file name> from <IP address> "The server returned an...
3
by: Loane Sharp | last post by:
Hi there I use the FileStream object to download a zip file over the internet to my local disk. The file downloads successfully, but when I attempt to unzip it, I'm told that the file is in use...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
2
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code...
1
by: DBC User | last post by:
Hello, I would like to copy a very large file (80MB) from the web, which is the best approach for downloading such a large file and also how can I show how much percent completed to user. I...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
6
by: Michael | last post by:
I need to copy a huge file (around 300Mb) from a mapped network drive to another. I have created a console application and used System.IO.File.Copy function. But I want to know the process of...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.