[Sollution] Safe mode problem

Hello people,

i love Zenphoto! you did a fine job making it!
when i was testing this on my local server all was okey. but on my provider i got a error when i tried to upload something.

"Warning: move_uploaded_file() [function.move-uploaded-file]: Unable blabalbalablaba"

so i begaan searching and i was something with safe_mode beeing on. now i dont have controle over the php.ini so changing was not an option.
after looking into the code and searching the internet i tried someting.

Create a function like in the admin.php (fifth line or so) :

function FtpMkdir($path, $newDir) {

$server='ftp.server.com'; // ftp server
$connection = ftp_connect($server); // connection
$user = "Name here";
$pass = "pass here";
$result = ftp_login($connection, $user, $pass);

// check if connection was made
if ((!$connection) || (!$result)) {
return false;
exit();
} else {
ftp_chdir($connection, $path); // go to destination dir
if(ftp_mkdir($connection, $newDir)) { // create directory
ftp_site($connection, "CHMOD 777 $newDir") or die("FTP SITE CMD failed.");
return $newDir;
} else {
return false;
}
ftp_close($connection); // close connection
}

}

After inserting this function change the following in the admin.php:
in the upload section of the code below the $uploaddir = SERVERPATH . '/albums/' . $folder; line

$path = 'Edit your path to albums here';
$newDir = strip($_POST['folder']);
if (!is_dir($uploaddir)) {
FtpMkdir($path, $newDir);
}

and you are done. if you get errors you proberly did not have the correct path in your $path, i had to try a couple of times to get this one correct.
But it seems to work.

So again thx for the great Zenphoto, and i hope some will find this usefull

Best regards,
Sign In or Register to comment.