On 08/03/07, Gordon Stewart <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi,
>
>  I'm wondering - is it possible to "zip" up files - after a PHP script
>  has altered them ?
>
>  Basically, I have 5-6 files - CSS / Javascript / Logo etc...
>
>  Im wanting to edit / change ONE of those files (Javascript file)...
>
>  Thats the easy part :)
>
>  Now - I want to zip up the files (& the updated file), & allow the
>  user to download them...
>
>  I guess I need to use a temporary directory for d/loading - right...
>
>  & then "save" the adjusted file first - & then zip them up ? - then
>  show the temprary URL to the end user - to d/load...
>
>  Or - is there a way to insert a file into a zip - directly from PHP output ?
>
>  (I'm guessing the temp directory is the way to go...)
>
>  --
>  G
>  NZ community groups - [EMAIL PROTECTED]
>  Freecycle Auckland :-
>  http://groups.yahoo.com/group/AucklandFreecycle/

Hi Gorden,

You might want to have a look at the php.net documentation for zip;
depending upon the version of PHP you're using and whether the
extension is present in your install of PHP will dictate how to move
on.

http://www.php.net/manual/en/ref.zip.php details information about the
PHP zip functions.
http://pecl.php.net/package/zip  Is the PECL package that the PHP
developers suggest you use if your version of PHP is 4.

It is possible to serve files directly from a PHP script.  For this to
work well you'll want to send a couple of headers and then output the
contents of the file to the user.  For an example of this search the
following page for "Content-Disposition"
(http://uk.php.net/manual/en/function.header.php);  This will save you
a redirect and also make sure the user gets a sensible filename when
they download the file rather than the temporary one you might assign
to the zip file.

Phill

Reply via email to