Re: fread() and windows directory permissions
| From: | Alessio Bernesco L�vore | Date: | Tue, 08 May 2001 12:30:46 +0000 |
| Subject: | Re: fread() and windows directory permissions | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7351@lists.php.net to get a copy of this message | ||
I think you could not use fopen to open just a directory, without specify a
file.
Instead try to use:
$handle=opendir('mydir');
while ($file = readdir($handle)) {
echo "$file\n";
}
closedir($handle);
Bye,
Alessio
""Benjamin Listwon"" <blistwon@paypal.com> ha scritto nel messaggio
news:9d8l8b$74i$1@toye.p.sourceforge.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello all,
> I am trying to read a directory on a Win2K installation of PHP4 and
> Apache 1.3. The following is the code I have to read in a directory.
>
> $dirname = "c:/temp";
> $dirhandle = fopen($dirname, "r");
> $dircontents = fread($dirhandle, filesize($dirname));
> fclose($dirhandle);
>
> This seems to work fine under Linux, but when I first tried it under
> Windows it gave an error about not having the permissions to read. I
> later discovered that I needed the directory to be on an NTFS
> partition (POSIX compliant) so I moved it to one. I then applied all
> necessary permissions, but the fread() still gets the same error, and
> printing the permissions of the directory is the same as it was
> before.
>
> I even tried running Apache as a service under the Administrator
> logon, which should in theory allow it to do everything I can, but
> the problem was still the same.
>
> My question. A) am i going about this all wrong? B) what can be done
> to actually read the directory?
>
> Thanks in advance.
>
> - --nettles
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 6.5.8 for non-commercial use
> <http://www.pgp.com>
>
> iQA/AwUBOvfYmdJHHObB9LWkEQJZzwCfTYOmxX6349lg8TTLHUnjS+HQW7QAoNmA
> uuqylewvfv52bdG8XAHtuQiU
> =LOnd
> -----END PGP SIGNATURE-----
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>