What I'm trying to do is build a php script that takes files and
directories uploaded to directory X by multiple users and moves them to other locations. I
have no problems reading and moving individual files, but I cannot get the
permissions right so that php (running as apache) can move an uploaded
directory. I can copy directories, but as soon as I try to remove the
originals I get permission denied. Which makes sense since apache doesn't
own the directories, the user who uploaded it does. Any ideas? The parent
directory X is owned by apache and has a+rwx rights.
As an example, user luis uploads directory doc with 3 documents to /apache/, which is owned by apache but world writable. I'd like the php code to move the doc directory to, say, /www/doc. I can do
exec("copy -R /apache/doc /www/doc") just fine, but I cannot succesfully execute
exec("rm -fR /apache/doc")
If I could have a directory that whatever is uploaded into it, no matter by
which user, the files and directories within it are always owned by apache, my problem would be solved. Is this possible?
Any help would be appreciated.
Thanks,
Luis