hi, first time poster here.. hopefully you guys can help me out w/ a few problems!
i'm currently trying to output a .zip file from the server... and to do that i use the following code:
//set the headers with the proper information
header("Content-type: Content-Type: application/x-zip");
header("Content-disposition: attachment; filename=myfile.zip");
[...]
//outputting file
$file=fopen($filename,"rb");
fpassthru($file);
fclose($file);
the $filename has been set in between...
i can download the file properly... and i can even open it in winzip...
basically, i am trying to open this zip file (sxi file in disguise) with OpenOffice Impress... which is basically a zip file of XML files.
I can open the file in winzip and i can even see the file data when i double click it... but when i open it w/ openoffice, it can't read it properly..... HOWEVER, if i use the zip file that $filename points to straight from the server, it works.
basically, i think when i do the fpassthru, it gets corrupted...
to make this a little clearer (i know it's confusing) say i do:
fpassthru($file) where filename = "myzip.zip"
it doesn't work...
but if i go to:
mydomain.com/myzip.zip, save the file and open it in openoffice, it DOES work!
try it yourself (you need openoffice though) (the link will work depending on if my computer is online or not):
output from server:
http://anonamos.no-ip.org:1234/~amos/mcac/web/pptChooser.php
directly linked:
http://anonamos.no-ip.org:1234/~amos/mcac/tmp/archive.zip
(the reason i don't want to link it is because i want to delete the file immediately after it is output)
any suggestions will be greatly appreciated!