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