Not extracting files use phpZip

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Not extracting files use phpZip

Post 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);
 
 
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Re: Not extracting files use phpZip

Post by psychotomus »

nebody?
manixrock
Forum Commoner
Posts: 45
Joined: Sun Jul 20, 2008 6:38 pm

Re: Not extracting files use phpZip

Post by manixrock »

Try extracting a normal zip file, not an uploaded one to see that the zip unarchiving functions do indeed work as expected.
Post Reply