How can I unrar file.rar on PHP?

Discussion in 'PHP' started by jujin, Dec 11, 2007.

  1. #1
    hi all
    How can I unrar one file.rar on PHP. My OS is Linux, I installed Unrar soft on linux and test it by command: mc unrar e customer.zar . Beside that I have set permission RW for the file. But when I run the code bellow it did not unrar customer.rar eventhough there is not any error. So is there anything to do or configuration before I run the code? :
    <?php
    $rar_file = rar_open('/var/www/html/assets/upload/customer.rar');
    if ($rar_file) {
    $entry = rar_entry_get($rar_file,$filename) or die("Failed to find such entry");
    $entry->extract(".");
    rar_close($rar_file);
    }
    ?>
    When I run the code, It say nothing but didnot unrar file customer.rar. Why? Please help me.
     
    jujin, Dec 11, 2007 IP
  2. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    the rar extension is buggy at best not to mention it behaves differently in both linux and windows which i found out the hard way.

    Wheres the $filename variable coming from ?
     
    ndreamer, Dec 11, 2007 IP