Hello,
I have a system (almost) built so a client can go in and add/edit/delete content files from a directory from their website. However, I cannot get PHP to remove files and it's driving me crazy (so far all is good except the delete part). I have a strong feeling this is an issue with permissions where PHP sets the owner to nobody.
So far I have PHP able to upload the file to a directory. The upload directory is set to 777 for testing.. After it uploads the file, I have PHP set the uploaded file to 0777 (using chmod('/home/user/path/file.txt'), and it works correctly, as expected. Owner is set as nobody and the file's octal value is 0777. So you would think this would give PHP the ability to remove this file, right? Nope... When I try running an unlink('/home/user/path/file.txt'); command, it cannot delete the file, even with nobody owning the file and permissions set where everybody can rwx the file.
So then I tried using ftp_connect(), ftp_delete(), etc... I was successfully able to have it connect, and change to the directory fine. When running the ftp_delete() function in PHP, it cannot delete any files either.
Simply put, I cannot delete any files using PHP (no way that I know of). Has anybody experienced these problems? Does anybody have a workaround?
Thanks much,
Erik
Edit by Erik: I figured it out. Sorry to bother! It was a problem in my code with urlencode/urldecode and my client giving weird filenames with non-standard characters. It does work! Rock Sign