This is a discussion on read directory file extension within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi all, I've this script who can show me all the files (but .. and .) in a directory. Can I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all, I've this script who can show me all the files (but .. and .) in a
directory. Can I put the extension of the file show into a variabile? really thanx! <?php $directory = "files"; $open_handle = opendir($directory); while($read = readdir($open_handle)) { if($read != "." && $read != "..") { echo "$read"; } } closedir($open_handle); ?> |
|
|||
|
Davide wrote:
> Hi all, I've this script who can show me all the files (but .. and .) in a > directory. > > Can I put the extension of the file show into a variabile? > http://php.net/pathinfo -- Oli |
|
|||
|
$ext = substr(strrchr($read, "."), 1);
GREAT :) Thanx Oli "Oli Filth" <catch@olifilth.co.uk> wrote in message news:IPY0e.600$SM4.8@newsfe2-gui.ntli.net... > Davide wrote: >> Hi all, I've this script who can show me all the files (but .. and .) in >> a directory. >> >> Can I put the extension of the file show into a variabile? >> > > http://php.net/pathinfo > > > -- > Oli |
![]() |
| Thread Tools | |
| Display Modes | |
|
|