Hi,
Just installed version 1.0.6 for first time. Thought I followed all the installation instructions but now I receive an error message when trying to create an album and upload photos:
--
Warning: mkdir(/usr/home/czcweb/public_html/zenphoto/albums/yes) [function.mkdir]: Permission denied in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 105
Warning: move_uploaded_file(/usr/home/czcweb/public_html/zenphoto/albums/yes/ss_lettr.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 117
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpOCWura' to '/usr/home/czcweb/public_html/zenphoto/albums/yes/ss_lettr.png' in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 117
MySQL Query ( INSERT INTO (`title`) VALUES ('YES'); ) Failed. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(`title`) VALUES ('YES')' at line 1
--
It appears this may have something to do with changing the permissions, or perhaps a database compatibility issue. Any help please?
Comments
/** UPLOAD IMAGES *************************************************************/
/*****************************************************************************/
} else if ($action == "upload") {
// Check for files.
$files_empty = true;
if (isset($_FILES['files']))
foreach($_FILES['files']['name'] as $name) { if (!empty($name)) $files_empty = false; }
// Make sure the folder exists. If not, create it.
if (isset($_POST['processed'])
&& !empty($_POST['folder'])
&& !$files_empty) {
$folder = strip($_POST['folder']);
$uploaddir = SERVERPATH . '/albums/'. $folder;
if (!is_dir($uploaddir)) {
mkdir ($uploaddir,777);
}
@chmod($uploaddir,777);
$error = false;
foreach ($_FILES['files']['error'] as $key => $error) {
if ($_FILES['files']['name'][$key] == "") continue;
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES['files']['tmp_name'][$key];
$name = $_FILES['files']['name'][$key];
if (is_image($name)) {
$uploadfile = $uploaddir . '/' . $name;
move_uploaded_file($tmp_name, $uploadfile);
@chmod($uploadfile,777);
} else if (is_zip($name)) {
unzip($tmp_name, $uploaddir);
}
}
}
$album = new Album($gallery, $folder);
$title = strip($_POST['albumtitle']);
if (!empty($title)) {
$album->setTitle($title);
$album->save();
}
header("Location: " . FULLWEBPATH . "/zen/admin.php?page=edit&album=$folder");
exit();
} else {
// Handle the error and return to the upload page.
$page = "upload";
$error = true;
if ($files_empty) {
$errormsg = "You must upload at least one file.";
} else if (empty($_POST['albumtitle'])) {
$errormsg = "You must enter a title for your new album.";
} else if (empty($_POST['folder'])) {
$errormsg = "You must enter a folder name for your new album.";
} else if (empty($_POST['processed'])) {
$errormsg = "You've most likely exceeded the upload limits. Try uploading fewer files at a time, or use a ZIP file.";
} else {
$errormsg = "There was an error submitting the form. Please try again. If this keeps happening, check your "
. "server and PHP configuration (make sure file uploads are enabled, and upload_max_filesize is set high enough). "
. "If you think this is a bug, file a bug report. Thanks!";
}
}
I'm on Dreamhost, and 777 has always worked for me just fine. Never had to chmod 755.
http://wiki.dreamhost.com/index.php/ZenPhoto
You may be right. I always used 755 since I thought 777 would not work on Dreamhost. After your posting I just tried 777 on a subfolder of /albums and it does work as well. So I guess it is an urban myth as far as Zenphoto is concerned. I suppose this (755 instead of 777) is only required for folders containing PERL scripts on Dreamhost. I vaguely remember this issue was also important with a phpBB install I once did.
Anyway I will stick with 755 since it is an added layer of protection.
- Uploads are uploading to the server so you could access them via their direct path, but they don't seem to be intergrating with the script - I've tried using both the admin area to upload images and also the FTP side but both don't work.
I have tried changing permissions but this isn't doing anything...
I also manage the webserver and I know for sure suexec isn't running, etc.
Any ideas? - I need this working within the next few hours or I'll find another application.
Cheers,
Liam