Directory Creation Problem

See all posts Reply

Directory Creation Problem new!
by Julio, 17 years, 6 months ago
Hello all,

I have an issue. When using the upload script and automatically creating a directory everything works fine. But when I try ro delete that directory that was just created I get a permission denied
from the server. Even when I try to change it to 777 it will not let me. I still get a permission denied or even an error sometimes.

If I create a directory on the server manual everything is ok I can delete it. Only directories that are created with the php class upload are the issue.

I also think that it could be some sort of the image beign "locked"? is that possbiel? I am just take a shot in the dark.

Any help would be greatly appreciated.

ThanksReply
Re: Directory Creation Problem new!
by Julio, 17 years, 6 months ago
ohh and by the way. I did make sure that the php upload file automatically created the directory and CHMOD to 777.

Thanks again.Reply
Re: Directory Creation Problem new!
by colin, 17 years, 6 months ago
I would guess that it is because PHP creates the directory under the PHP or webserver user.

So via FTP, you can't delete it since you are the FTP user, or anyway an user different that the webserver/PHP user.

Try maybe using the PHP function chmod() to change the user. Alternatively, you can write a simple PHP script which would delete the directory for you.Reply
Re: Directory Creation Problem new!
by Julio, 17 years, 6 months ago
Hello again,

I've tried both ways and still not luck in deleting the test directories. I tried on a diffrent server and received the same error. Is there anything else I can try? or dies this script not work on shared servers?

Thank you again.Reply
Re: Directory Creation Problem new!
by Julio, 17 years, 6 months ago
Thanks for taking the time out to trouble shoot this. I can see the properties for the directory in my FTP client (ACE FTP3)I can also see them via the cpanel. Whats weird is that when I try to CHMOD via cPanel it shows the the directory is 777 but when I use my FTP it shows it as 755.

I am the user and owner so I think that it should allow me to make the changes.

I do not understand what do you mean by copying and pasting the listing.

Thanks again for taking out the time.Reply
Re: Directory Creation Problem new!
by colin, 17 years, 6 months ago
I'm afraid that you will have to ask your hosting company for some help. It is possible that they've wrongly configured their server. Maybe the suid set on user accounts...

By listing, I meant the log.Reply
Re: Directory Creation Problem new!
by Steve, 17 years, 5 months ago
Try chmod 0777 directory where you actually execute the code of upload.php.Reply
Re: Directory Creation Problem new!
by Speshdiv, 17 years, 3 months ago
I have a solution for this issue. I also had this error. You can only delete the locked files using Linux commands via SSH.

The thing you've got to do is this: disable these in both class.upload.php and upload.php:

$this->dir_auto_create   = false;    
$this->dir_auto_chmod    = false;    
$this->dir_chmod         = false;

If you follow my solution, you don't let the script generate your folders. You create your own, using these commands, just after the <?php of upload.php

$folderName = $_POST["folderName"];
$foo='../YourFolder/'.$folderName.'/';
$old_umask = umask(0);
mkdir($foo,0777);
umask($old_umask);

$folderName is a variable you post from the form Process('../YourFolder/'.$imageName.'');

You'll see that the directories and files you create are completely writeable. Maybe this is a nice thing to include with the oncoming version?

Greetings!Reply
Re: Directory Creation Problem new!
by colin, 17 years, 3 months ago
Thanks for the analysis and solution. I will do some test, and see what I can change in the class.Reply
Re: Directory Creation Problem new!
by Speshdiv, 17 years, 2 months ago
No, thank you for coding Photoshop CS2 into an upload script. It is wonderful, told all my friends about it! I hope my comment will be of some use!Reply
Re: Directory Creation Problem new!
by colin, 17 years, 2 months ago
My pleasure. Thanks for your comments.

If you want to help beyond sending useful comments and doing tests, you can rate the class on PHP Classes, or Hotscript; you can also write a review for the class; or even donate a little bit!Reply