coppermine-gallery.com/forum

Support => Older/other versions => cpg1.1d PHPnuke Support (deprecated) => Topic started by: jeroen on November 11, 2003, 02:51:52 PM

Title: Error with uploading files..
Post by: jeroen on November 11, 2003, 02:51:52 PM
Hi,

I have a problem when users try to upload pics in an album.

My directory is added to the openbasedir.

The owner of the newly created folder is set to apache. I think thats te problem so I tried to add the line chown($dest_dir, "myusername"); right after the line that set the chmod to 777 (In the file db_input.php) doesnt help.

The error I get is that the file cannot be copied to the new directory.

who can help me?
Title: Error with uploading files..
Post by: DJMaze on November 11, 2003, 06:53:13 PM
remove mkdir and chmod and change it to this:

$connection = ftp_connect('yourdomain.com or IP');
$username = 'user';
$pass = 'pass';
$login_result = ftp_login($connection,$username,$pass);
// check to make sure you're connected:
if ((!($login_result)) or (!($connection)))
{
   // error....do something
}
else
{
// we're good to go -- the connection was made
ftp_chdir($connection, '/public_html/gallery/albums/userpics');
ftp_mkdir($connection, 'anotherdir');
ftp_chmod($connection, 0777, 'anotherdir');
ftp_close($connection);
}
Title: Error with uploading files..
Post by: jeroen on November 11, 2003, 10:25:42 PM
ehh can you please explain what part I should change?

Got this(db_input.php):  

// Pictures are moved in a directory named 10000 + USER_ID
        if (USER_ID && !defined('SILLY_SAFE_MODE')) {
                $filepath = $CONFIG['userpics'].(USER_ID+FIRST_USER_CAT);
            $dest_dir = $CONFIG['fullpath'].$filepath;
                if (!is_dir($dest_dir)) {
                    mkdir($dest_dir, octdec($CONFIG['default_dir_mode']));
                        if (!is_dir($dest_dir)) cpg_die(CRITICAL_ERROR, sprintf($lang_db_input_php['err_mkdir'], $dest_dir), __FILE__, __LINE__, true);
                    chmod($dest_dir, octdec($CONFIG['default_dir_mode']));
                        $fp = fopen($dest_dir.'/index.html', 'w');
                        fwrite($fp, ' ');
                        fclose($fp);
                }
                $dest_dir .= '/';
                $filepath .= '/';
        } else {
                $filepath = $CONFIG['userpics'];
            $dest_dir = $CONFIG['fullpath'].$filepath;
        }
Title: Error with uploading files..
Post by: DJMaze on November 11, 2003, 10:44:32 PM
Try to change your posted from db_input into this, although i've never tested, and change 'user', 'pass', 'yourdomain' into your ftp settings.
Change '/public_html/gallery/albums/userpics' to the path of your userpics directory

// Pictures are moved in a directory named 10000 + USER_ID
   if (USER_ID && !defined('SILLY_SAFE_MODE')) {
      $filepath = $CONFIG['userpics'].(USER_ID+FIRST_USER_CAT);
       $dest_dir = $CONFIG['fullpath'].$filepath;
      if (!is_dir($dest_dir)) {
$connection = ftp_connect('yourdomain.com or IP');
$username = 'user';
$pass = 'pass';
$login_result = ftp_login($connection,$username,$pass);
// check to make sure you're connected:
if ((!($login_result)) or (!($connection)))
{
    // error....do something
    cpg_die(CRITICAL_ERROR, sprintf("FTP connection failed for ", $dest_dir), __FILE__, __LINE__, true);
}
else
{
// we're good to go -- the connection was made
ftp_chdir($connection, '/public_html/gallery/albums/userpics');
ftp_mkdir($connection, $dest_dir);
ftp_chmod($connection, 0777, $dest_dir);
ftp_close($connection);
}
/*
         mkdir($dest_dir, octdec($CONFIG['default_dir_mode']));
         if (!is_dir($dest_dir)) cpg_die(CRITICAL_ERROR, sprintf($lang_db_input_php['err_mkdir'], $dest_dir), __FILE__, __LINE__, true);
          chmod($dest_dir, octdec($CONFIG['default_dir_mode']));
*/
         $fp = fopen($dest_dir.'/index.html', 'w');
         fwrite($fp, ' ');
         fclose($fp);
      }
      $dest_dir .= '/';
      $filepath .= '/';
   } else {
      $filepath = $CONFIG['userpics'];
       $dest_dir = $CONFIG['fullpath'].$filepath;
   }
Title: Error with uploading files..
Post by: jeroen on November 12, 2003, 02:27:59 PM
Ehh I get this error:

Fatal error: Call to undefined function: ftp_connect() in /usr/local/psa/home/vhosts/barnevelders.com/httpdocs/web/e107_plugins/coppermine_menu/db_input.php on line 209

there is no function ftp_connect.. but now I see that I maybe posted this thread in the wrong section. I'm using Coppermine Photo Gallery 1.1.1 - Devel  :oops:
Title: Error with uploading files..
Post by: gtroll on November 12, 2003, 07:58:16 PM
ftp_connect is available in php3.2.3+ when compiled with --enable-ftp setting check your <?phpinfo();?> to see if this is enabled.
Title: Error with uploading files..
Post by: jeroen on November 12, 2003, 09:16:52 PM
It's enabled if i'm not wrong...

please check it at, www.barnevelders.com/test.php
Title: Error with uploading files..
Post by: DJMaze on November 12, 2003, 10:08:43 PM
your configure command doesn't include ftp.

Ask your host for a better setup and config for PHP