php-windows | 2001051

Re: [PHP-WIN] fread() and windows directory permissions From: Alessio Bernesco Lāvore (alessio.bernesco <email protected>)
Date: 05/08/01

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 <email protected>> ha scritto nel messaggio
news:9d8l8b$74i$1 <email protected>
> -----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 <email protected>
> For additional commands, e-mail: php-windows-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe <email protected>
For additional commands, e-mail: php-windows-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>