Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/codes-snippets/config.php on line 6
Extract Rar Files - Php

Extract Rar Files - Php

How to extract rar files using php code?

Snippet Code


  
Rate this page :
  [ 0 votes]

Rar package should be installed before rar file extraction. The extract function extracts rar file and save it to the desired file path. The following php code can be used to unrar files.

<?php $rarfile = rar_open('demo.rar') or die("Can't open Rar archive"); $entries = rar_list($rarfile); foreach ($entries as $entry) { echo 'Filename: ' . $entry->getName() . "n"; $entry->extract('/dir/extract/to/'); } rar_close($rarfile); ?>

Tags


Ask Questions

Ask Question