[thelist] Re: [PHP + Javascript?] directory - only listing images below a certain
throwaway at gmontague.co.uk
throwaway at gmontague.co.uk
Tue Sep 30 05:06:13 CDT 2003
[snip]
'Volters - Can anyone think of a way to show only images / files in a
directory that are above / below a certain filesize?
PHP gives lots of nice information for uploading, but when traversing a
filesystem, it looks like all i can get is unix permissions, id_dir()
and filenames.
[/snip]
Do you mean as in an index-type page or a general rule for the server not to
serve files above/below size x?
If its the former then you can just do an opendir(), readdir(),is_file(),
filesize() loop and only display those files that have the appropriate filesize().
And if you also want to filter based on file type you check...
$extension = strrchr(basename($file_name), "."); //get the file extension
and then compare extension to an array of filetypes ('jpeg','jpeg','png', etc)
in a case insensitive search.
HTH,
Gav
More information about the thelist
mailing list