Solved

Compress files

Posted on 2002-03-03
2
174 Views
Last Modified: 2008-02-07
Hi all,

  I would like to make a function that can let users download zip file when they click on a link. This zip file actually contains all the files of a directory and i want it to be made automatically.
  Should i use the exec() function? Or any php functions can help me to zip files?
  Also, I am using linux, can I create the zip file in winzip format instead of gzip without installing library?
  Thx!!!
0
Comment
Question by:colemanchow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 6838401
if it a zip file then no problme at all

just put the path of that file in link

like

<a href="full_path_of_file">name of file </a>


yes u can create,but  zip/unzip utility is need to be installed on the server , just type zip/unzip to check , is it on your server ?


Hope this will help

Lk:o)
0
 
LVL 8

Accepted Solution

by:
us111 earned 50 total points
ID: 6838930
yes, use the exec function
exec("gzip yourfile");

note that winzip can read & extract the .gz files without any problems.

If you have a folder, the better is to use tar and then create the zip files.
Winzip can untar & unzip files easily


0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 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