note 42369 deleted from function.fileowner by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 13 May 2004 20:20:42 +0000 |
| Subject: | note 42369 deleted from function.fileowner by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69584@lists.php.net to get a copy of this message | ||
Note Submitter: kumar mcmillan
----
simple way to find out if PHP owns a file...
<?php
$filename = '/example/uploaded/image.jpg';
if(strpos(shell_exec('id'), 'uid='.fileowner($filename).'(') !==
false) {
// do owner stuff ...
chmod($filename, $permissions);
}
?>
only tested in OpenBSD, Mac OS X, probably won't work in safe mode or Windows.