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);