for unknown reason.. many programer has problem with php_rar (in windows).. i came up with this ... and it work.
basicly is same as above but only extract only. The problem will come up if the file rar corrupt, exist and soon
_______________________________
<?php
$appRar ="C:/Program Files/WinRAR/unrar.exe";
#this is false..
$appRar = '"C:\Program Files\WinRAR\unrar.exe"';
#change this
$opt="e";
$target="1.rar";
$do ="$appRar $opt $target";
exec($do,$aOut);
print_r($aOut);
?>
-------------------------------------------------
For windows user: try using bat file for test.
all user: please read man unrar, above using e because this only extract. But you should notice about other option like "y","x", etc
i type the option here if you too lazy
http://landavia.multiply.com/journal/item/284/option_for_unrar
$aOut are array for the output after you run the script $do
Exemples
Exemple #1 Exemple d'utilisation de l'extension Rar
<?php
$rar_file = rar_open('example.rar') or die("Impossible d'ouvrir l'archive Rar");
$entries = rar_list($rar_file);
foreach ($entries as $entry) {
echo 'Nom du fichier : ' . $entry->getName() . "\n";
echo 'Taille de l\'archive : ' . $entry->getPackedSize() . "\n";
echo 'Taille décompressée : ' . $entry->getUnpackedSize() . "\n";
$entry->extract('/dir/extract/to/');
}
rar_close($rar_file);
?>
Cet exemple ouvre l'archive Rar et extrait chacune des entrées dans un dossier spécifié.
Exemples
landavia81 at gmail dot com
21-Jan-2009 06:00
21-Jan-2009 06:00
