Page 1 of 1

Unzipping files zipped under unix

Posted: Mon Nov 20, 2006 12:50 pm
by coolprgrmr
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
I have a small script which zips files and makes it available for being downloaded to clients computer.
The snipped of the code which zips the files and makes if available for download is

Code: Select all

<?
$zfiles = "file1 file2 file3 file4 ...  file50" =>files to be downloaded

       header('Content-type: application/zip');
      header('Content-Disposition: attachment;filename=images.zip');
         $zipfiles = "/usr/local/bin/zip  -  ". $zfiles;
         $handle = popen ($zipfiles, 'r');

fpassthru($handle);
?>
The above code works fine and I can unzip the files under unix with unzip command however when I try to unzip the images.zip file under windows using winzip, I keep getting the following error message
start of central directory not found, zip file corrupt.
Appreciate if anybody can help me in this regards. Is there any option which needs to be set while zipping the files to make the zip file compatible with windows.

Thanks,


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Nov 20, 2006 3:15 pm
by feyd
You could look into using a more cross platform zipping method such as the class(es) in Code Snippets that were posted by redmonkey.

viewtopic.php?t=29027
and
viewtopic.php?t=29066