Link to home
Start Free TrialLog in
Avatar of COMPUTER_SC_STUDENT
COMPUTER_SC_STUDENT

asked on

Zip files & PHP

How can I zip and unzip files using php ... Can any one give me a simple code plz
                    Thank you in advance,
Avatar of mobana
mobana

how if you copy your text and paste it into new text file, e.g: world.txt
<?
$filename = "world.txt";
$fp = fopen($filename, "r");
$buf = fread($fp, filesize($filename));
echo $buf;
?>
hope can help.
one solution would be to use COM (if your server is windows)
another would be to use the OLE class form pear(go to http://pear.php.net/ and search for OLE)
... sorry I've posted to the wrong question
uhm....sorry for wrong post too. it happened same with me...sound the id numbering make the wrong post when there is new thread come in??
Avatar of COMPUTER_SC_STUDENT

ASKER

I need a complete code plz for openning a Microsoft Word document which already exist ....
I am new in php    plz give me a direct answer plz ....
for 20 points ?!? :)
Avatar of Giovanni G
Please don't create more confusion than needed. This thread is about zip files, this one http:Q_20961487.html is about word files (not "world" *laughing*).
unzipping files in PHP:
system("unzip -a -q yourfile.zip");
<?php
system("unzip -a -q word.zip");
?>

I tried this code but my file "word.zip" still zipped ...
Are you sure that is the code  :)
ASKER CERTIFIED SOLUTION
Avatar of dorward
dorward

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1. Are you sure you have the "unzip" command? Try specifying the full location to it

How I can check if I have it or not plz let me know...

2 & 3 is ok .... but 1 I could not check
this should give you a clue:
<?php
system("unzip --help 2>&1");