0

Hi,
I hope this is a PHP issue as I miss posted earlier (sorry).
I have created a page for uploading files onto my computer from the internet using PHP.
My page creates a folder to hold the uploaded files in which can be deleted.
BUT once the uploaded file is transfered to this folder I can neither delete the upload file or folder even though they are on my computer.

If I try to delete them I get an "Access denied" message. If I try to change the permissions on them (ie chmod o+w...) I get an "Operation not permitted" message.

The folder is created with :
mkdir("/user/X/pub_html/lectures/$parent_folder/$folder_name", 0755);- it is owned by nobody (as PHP is owned by nobody) & the permissions on the folder are : drwxr-xrwx

The uploaded file is created with :
if (move_uploaded_file($_FILES, $uploadfile))
{
chmod($uploadfile, 0755);
echo '<p id="message">The file has been uploaded</p>';
} etc ..
- it is owned by nobody & the permissions on the files are : -rwxr-xr-x

Any ideas how I might solve this. I have also tried force removing the files with unix commands and using the remove folder PHP command.
Much Thanks,
Sean

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by Troy
0

r u creating the folder dynamically???
if not just change the permission of the folder manually using the ftp software....

0

Thanks for the reply.
The php file creates the folder.
Will "ftp software" solve my problem? I know what ftp is (ie what it stands for), not sure how to use it in relation to this problem though.

0

You are creating both the dir and the file with permissions 755. This means that the owner ('nobody' in this case) can execute, write, & read. Everybody else can execute and read, but not write.

Apparently, your own user account is not a super-user (root privs). To delete the files, you either need to become root, or the folder needs 777 (read, write, execute) permissions. This is because to delete files in a directory, the parent directory must have write permissions.
http://www.zzee.com/solutions/unix-permissions.shtml

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.