unzip file to new folder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if we unzip folder it is cretes folder with same zip folde namer.means if we unzip 'test.zip' it creates folder test 
but we want to unziponly contents of it  to a new directory
we are using this function
$zip = new ZipArchive; 
    if ($zip->open($release)){ 
        $path = getcwd() . "/files/"; 
        $path = str_replace("\\","/",$path); 
         if($zip->addEmptyDir('newDirectory')) {
        echo 'Created a new root directory';
    } else {
        echo 'Could not create the directory';
    }
        
        echo $path; 
        echo $zip->extractTo($path); 
        $zip->deleteName('Release1.2.8.1');
        
        $zip->close(); 
        echo 'Done.'; 
    } else { 
        echo "Error"; 
    } 



      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux