Re: Uploading and directory permissions
| From: | James E Hicks III | Date: | Mon, 10 May 2004 12:56:41 +0000 |
| Subject: | Re: Uploading and directory permissions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185791@lists.php.net to get a copy of this message | ||
On Monday 10 May 2004 05:20 am, Mario wrote:
> Anyways I was wondering if there is a way to upload through PHP without
> having "write" permission to "all". Is there a way maybe, for the script,
> to change permission to "write" before the upload and then take it off? or
> anything else I can do to protect the dir?
You could keep your upload directory with 777, but after uploading move files
to safer directory with stricter file permissions. You could probably even
get away with just changing the permission of the file after it was uploaded.
http://php.net/filesystem
http://php.net/manual/en/function.chmod.php
// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);
James Hicks