WordPress Theme Installer > Need some advice
<p>I've got a pretty popular WordPress theme that has a template switcher (basically just changes the stylesheet assigned to the theme for a completely different look and stores this as setting in the db).</p>

<p>The way I do this is that I have a "styles" directory under my theme folder and inside of that, I have a single folder for every one of my templates that work with the theme.</p>

<p>Inside each of these folders is a stylesheet, along with any images the template needs.</p>

<p>I'd like to create an uploader in my theme options panel that allows one to select a zip file from their PC and install a new template to the theme.</p>

<p>Basically, I suppose I'm just looking for an upload routine that can take a zip file, extract it and place it in my theme's style folder. If there is already a folder by the same name, I'd like the routine to prompt for overwrite or rename.</p>

<p>Any ideas?</p>

<p>This appears to be the most promising thus far. I just need some tips on how to get this integrated with an file > uploader widget.</p>

<pre><code>// create object
$zip = new ZipArchive() ;

// open archive
if ($zip-&gt;open(‘archive. zip’) !== TRUE) {
die (‘Could not open archive’);
}

// extract contents to destination directory
$zip-&gt;extractTo(‘/ tmp/extracted/ ‘);

// close archive
// print success message
$zip-&gt;close();
echo ‘Archive extracted to directory’;
</code></pre>
