Page 1 of 1

Not extracting files use phpZip

Posted: Sat Jul 26, 2008 7:58 pm
by psychotomus
just doesn't want to extract the .ZIP files. it gives no errors. any ideas why?
this is just a sniplet. new_id is a #

Code: Select all

 
$themes_url = "testrun/wp-content/themes";
 
    if(!empty($_FILES["themeUpload"]["tmp_name"]))
 
    {
 
        $theme_file_dest = "downloads/".$_FILES["themeUpload"]["name"];
 
        $new_theme_name = "downloads/".$new_id.".zip";
 
        $old_name = explode(".", $_FILES["themeUpload"]["name"]);
 
        
 
        if(!file_exists($theme_file_dest))
 
        {
 
            copy($_FILES["themeUpload"]["tmp_name"], $theme_file_dest);
 
        }
 
        
 
        $theme_file = new ZipArchive;
 
        $zip_open = $theme_file->open($theme_file_dest);
 
        $theme_file->extractTo($themes_url);
 
        $theme_file->close($zip_open);
 
        rename($theme_file_dest, $new_theme_name);
 
        rename($themes_url . '/' . str_replace(".zip",'',$_FILES["themeUpload"]["name"]), 'testrun/wp-content/themes/' . $new_id);
 
 

Re: Not extracting files use phpZip

Posted: Mon Jul 28, 2008 6:02 pm
by psychotomus
nebody?

Re: Not extracting files use phpZip

Posted: Mon Jul 28, 2008 6:49 pm
by manixrock
Try extracting a normal zip file, not an uploaded one to see that the zip unarchiving functions do indeed work as expected.