Deleting Uploaded Files?

Reply

Join Date: Feb 2006
Posts: 12
Reputation: seh1 is an unknown quantity at this point 
Solved Threads: 0
seh1 seh1 is offline Offline
Newbie Poster

Deleting Uploaded Files?

 
0
  #1
Mar 21st, 2006
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['userfile']['tmp_name'], $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
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 1
Reputation: maxtech is an unknown quantity at this point 
Solved Threads: 0
maxtech maxtech is offline Offline
Newbie Poster

Re: Deleting Uploaded Files?

 
0
  #2
Mar 22nd, 2006
r u creating the folder dynamically???
if not just change the permission of the folder manually using the ftp software....
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 12
Reputation: seh1 is an unknown quantity at this point 
Solved Threads: 0
seh1 seh1 is offline Offline
Newbie Poster

Re: Deleting Uploaded Files?

 
0
  #3
Mar 22nd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: Deleting Uploaded Files?

 
0
  #4
Mar 22nd, 2006
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
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3688 | Replies: 3
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC