RE: PHP Zip Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard,

Thank you for your post and the link to your rant. Indeed I am a PHP newbie
and have fallen into the advice I have been given through google. . .

I have added an exit and probably owe you a donut as I had to remove a
couple of echo's from my code! However, the good news after all of this is
that my code is now working and I can finish off my tests.

Thanks again

Matt

-----Original Message-----
From: Richard Lynch [mailto:ceo@xxxxxxxxx] 
Sent: 06 November 2006 21:02
To: Matt Street
Cc: 'php-general@xxxxxxxxxxxxx'
Subject: RE:  PHP Zip Question

On Mon, November 6, 2006 6:28 am, Matt Street wrote:
> Thanks for the response, I decided that it was easier to unpack the
> zip
> during the upload process and then delete the zip. I can then indicate
> which files I want to zip up and this works (opening the zip on the
> server), but, and it's a big but, when the zip is downloaded to the
> users machine it is being corrupted!
>
> To force the download I use:
>
> header('Content-type: application/zip');
> header('Content-Disposition:  attachment; filename='.$tutorzipfile);
> readfile($filename);
>
> Which correctly gives me:
>
> Content-Type: application/zip
> Content-disposition: attachment; filename=tutorzipfile.zip
>
> when viewing the LiveHTTPHeaders extension in firefox.

Rant #37
http://richardlynch.blogspot.com/

> However, when I view the zip file that is downloaded to my machine, in
> Textpad, php has appended the directory information of the files I'm
> zipping up onto the front of the zip file, so it no longer starts
> PK!!!

PHP didn't do it.

Your zip routines may have done it.

Your code may have done it.

But PHP is not, no its own, just outputting the directory info for no
real reason.

Put an exit right before you readfile() and the headers.

You may need to move the headers down below all the code that
calculates what's getting zipped up and all that...

Dollars to donuts says you've left behind a debugging:
echo pwd();
or something similar.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux