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

Recommended Answers

All 3 Replies

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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.