coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Upload => Topic started by: yoshikiwei on September 22, 2004, 08:22:17 AM

Title: Quick solution for 'edit' folder being deleted
Post by: yoshikiwei on September 22, 2004, 08:22:17 AM
My /albums/edit folder is being deleted every now and then.
And getting frustrated with it, I decided to modify the following codes in upload.php

upload.php, find
function spring_cleaning($directory_path) {

   //First we get the transitory directory handle.
   $directory_handle = opendir($directory_path);

   // Exit if the directory cannot be opened.
   if(!$directory_handle) {

       // Return.
      return;

   }

replace with
function spring_cleaning($directory_path) {

   //First we get the transitory directory handle.
   $directory_handle = @opendir($directory_path);

   // Exit if the directory cannot be opened.
   if(!$directory_handle) {

       // Return.
mkdir($directory_path, 0777);
       return;

   }


this codes simply creates the edit folder if it cannot be opened

use this at your own risks and preference
Title: Re: Quick solution for 'edit' folder being deleted
Post by: kegobeer on September 22, 2004, 06:12:07 PM
Actually, you should use the albums path that's in the config settings instead of hardcoding it.  Like this:

global $CONFIG;
mkdir('.' . $CONFIG['fullpath'] . 'edit', 0777);
Title: Re: Quick solution for 'edit' folder being deleted
Post by: yoshikiwei on September 22, 2004, 06:45:36 PM
true enough
or perhaps I should use $directory_path instead

btw, have the dev team already know what causes the edit folder to be deleted ?
Title: Re: Quick solution for 'edit' folder being deleted
Post by: erroneus on September 22, 2004, 10:07:19 PM
Ok, so what's the fix for this?
Title: Re: Quick solution for 'edit' folder being deleted
Post by: Joachim Müller on October 26, 2004, 05:16:46 AM
as suggested (just summarizing the previous posts up): edit upload.php, findfunction spring_cleaning($directory_path) {

    //First we get the transitory directory handle.
    $directory_handle = opendir($directory_path);

    // Exit if the directory cannot be opened.
    if(!$directory_handle) {

        // Return.
       return;

    }
and replace withfunction spring_cleaning($directory_path) {
    global $CONFIG;
    //First we get the transitory directory handle.
    $directory_handle = @opendir($directory_path);

    // Exit if the directory cannot be opened.
    if(!$directory_handle) {
mkdir('.' . $CONFIG['fullpath'] . 'edit', 0777);
        // Return.
        return;
    }
This is a quick-and-dirty fix - wouldn't mind if I were you though, it won't break anything.

Joachim
Title: Re: Quick solution for 'edit' folder being deleted
Post by: Pauky on November 27, 2004, 08:40:05 PM
Hey guys,

I'm assuming the above problem relates to me.  I've noticed that my 'edit' directory keeps losing it's permissions (from 755 to 666).  I think this is because it's getting deleted as well.  I changed the code in the 'pload.php' but it's not adding the 777 permissions and I get the following error:

Warning: mkdir(.albums/edit): No such file or directory in /c59/ewiddel/gallery/upload.php on line 402


I did a search on the above errors with different variations, but found thing.  

Any ideas guys?  In the mean time, I'll call my Web hosting company to have them change the permissions to 755 again.  Thanks in advance.
Title: Re: Quick solution for 'edit' folder being deleted
Post by: Casper on November 28, 2004, 04:41:29 PM
Open your include/picmgmt.inc.php file, and find and change '0666' to '0755'.
Title: Re: Quick solution for 'edit' folder being deleted
Post by: Pauky on November 30, 2004, 01:54:10 AM
I changed the 0666 to 0755 on the include/picmgmt.inc.php file and that didn't seem to work.  I verified that the Albums, Albums/userpics, and albums/edit folders are set to 755.

I still get Warning: mkdir(.albums/edit): No such file or directory in /c59/ewiddle/gallery/upload.php on line 402 when I click on the upload link and the following when I actually try and upload a picture (the same symptoms that everyone gets when the 'edit' folder isn't set to 755 although mine is.  Any ideas?

Warning: move_uploaded_file(./edit/mHTTP_temp_2995890e.jpg): failed to open stream: No such file or directory in /c59/ewiddle/gallery/upload.php on line 1155

Warning: move_uploaded_file(): Unable to move '/tmp/phpkkemiK' to './edit/mHTTP_temp_2995890e.jpg' in /c59/ewiddle/gallery/upload.php on line 1155