What's causing this permission's error and how can I work around it?
- by Scott B
Warning: move_uploaded_file(/home/site/public_html/wp-content/themes/mytheme/upgrader.zip) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/site/public_html/wp-content/themes/mytheme/uploader.php on line 79
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phptempfile' to '/home/site/public_html/wp-content/themes/mytheme/upgrader.zip' in /home/site/public_html/wp-content/themes/mytheme/uploader.php on line 79
There was a problem. Sorry!
Code is below for that line...
// permission settings for newly created folders
$chmod = 0755;
// Ensures that the correct file was chosen
$accepted_types = array('application/zip',
'application/x-zip-compressed',
'multipart/x-zip',
'application/s-compressed');
foreach($accepted_types as $mime_type) {
if($mime_type == $type)
{
$okay = true;
break;
}
}
$okay = strtolower($name[1]) == 'zip' ? true: false;
if(!$okay) {
die("This upgrader requires a zip file. Please make sure your file is a valid zip file with a .zip extension");
}
//mkdir($target);
$saved_file_location = $target . $filename;
//Next line is 79
if(move_uploaded_file($source, $saved_file_location)) {
openZip($saved_file_location);
} else {
die("There was a problem. Sorry!");
}