Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Error with uploading files..  (Read 11359 times)

0 Members and 1 Guest are viewing this topic.

jeroen

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Error with uploading files..
« 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?
Logged

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Error with uploading files..
« Reply #1 on: November 11, 2003, 06:53:13 pm »

remove mkdir and chmod and change it to this:

Code: [Select]
$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);
}
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

jeroen

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Error with uploading files..
« Reply #2 on: November 11, 2003, 10:25:42 pm »

ehh can you please explain what part I should change?

Got this(db_input.php):  

Code: [Select]
// 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;
        }
Logged

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Error with uploading files..
« Reply #3 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

Code: [Select]
// 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;
   }
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

jeroen

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Error with uploading files..
« Reply #4 on: November 12, 2003, 02:27:59 pm »

Ehh I get this error:

Code: [Select]
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:
Logged

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
Error with uploading files..
« Reply #5 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.

jeroen

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Error with uploading files..
« Reply #6 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
Logged

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Error with uploading files..
« Reply #7 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
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 18 queries.