----- Original Message ----- From: "Lenny Davila" I have a script that uploads and resizes an image and puts it in a users directory
www.mysite.com/members/USERNAME/IMAGE <http://www.mysite.com/members/USERNAME/IMAGE%20_FILE.jpg> _FILE.jpg While testing I had to delete a few images. I could not delete them by FTP or in my plesk control panel. Only through using winSCP and logging on as root into the server. Why is this happening? I have even tried to chmod the file by using this code after the image copy: chmod($new_image_name, 0777); Does anyone have any other ideas? PHP safe mode is on Thanks, Lenny ------------------------------------ Hi Lenny, You haven't given enough information for us to answer this question. We don't even know what OS your server is running. chmod 777 doesn't work on all servers as some sysadmins disable the effect of 777 for security. The most probable answer to your question is that your PHP is running in the authority of the user and not the authority of yourself. This means the user is the owner of the file and therefore you do not have delete permission until you log in as root. If this bothers you then you can run PHP in a wrap or as a CGI however this means your script runs with you authority and a successful hacker can obtain all your permission's. Another option is write a script to delete files and use it in the same way as the user ie - from a browser. Of course you need some protection such as a password. Running as a CGI is PHP wide so it is not always the best option. A wrapper can be used in a script by script basis. Not all hosting providers have wraps available you will have to read up on your providers site. FTP can run in the same three levels of permission's - user/public - group - owner. Public ftp is user/public. A created ftp user account is group and the root ftp account is owner. A browser window is user/public. A password protected directory can be group or owner. If you want to find out more then use the PHP directory listing commands in conjunction with the system POSIX or PHP extensions. See - http://php.net/manual/en/ref.info.php getmyuid getmypid get_current_user filegroup fileowner stat