?
Solved

create a zip file on an asp page

Posted on 2009-12-28
5
Medium Priority
?
693 Views
Last Modified: 2012-05-08
I need to create an asp page that will return a zip file that I want to dynamically create, containing an image that I pull from a url and some other files that I will want to pull from the server.

something along the lines of:

<%
Response.ContentType = "application/zip"
Response.Buffer = TRUE

set zip server.createobject("some zip component")

zip.addfile("http://www.mydomain.com/myimage.gif")
zip.addfile("localtextfile.txt")

response.write(zip.output())
%>

Can anyone provide me with some example asp code and a suggestion for a component to use.
0
Comment
Question by:DanM711
5 Comments
 
LVL 22

Expert Comment

by:neeraj523
ID: 26136221
Hello

You will have to use a thrid party command line based zip application to zip files using asp. as suggested above, you can use pkzip application for the purpose. But remember following before proceeding

1. You need to have sufficient permissions at your web server to host thrid party componenets
2. You should have write permissions in the folder where you are looking to store resulting zip file.

Ask me if any further details are needed.
0
 

Author Comment

by:DanM711
ID: 26139558
Thanks, but i'm looking for some example code that will return a zip file, not just create one. So when a user clicks on a link to my asp page it will come up with a open / save dialogue for the zip file straight away.

And i need a component that will allow me to add files into the zip file i'm creating by specifying urls and file paths.
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 26143407
please answer my above 2 questions before i provide you a sample code.. without having server access, this logic wont work..
0
 
LVL 12

Accepted Solution

by:
R_Harrison earned 2000 total points
ID: 26180078
The below code will do just that with csASPZip which is available from Chestysoft (http://www.chestysoft.com/zipfile/)  - no need to set the response content type, etc...

If you use the trial version you simply need to change the 1st line to
Set Zip = Server.CreateObject("csASPZipFileTrial.MakeZip")
Set Zip = Server.CreateObject("csASPZipFile.MakeZip")
Zip.ZipAdd("http://www.somedomain.com/someimage.jpg")
Zip.ZipAdd("c:\inetpub\somelocalfile.txt")
Zip.StreamZip "Backup.zip"

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question