if you know the name of the file, and the directory, then use:

    if (file_exists("directory/filename.jpg")) {
        print "found";
    }

Watch out for case sensitive OS's tho. x.jpg != X.JPG

A more complete method for searching a directory would be:

$handle=opendir('.');
while (($file = readdir($handle))!==false) {
    if (strtolower($file)==strtolower($filetolookfor)) {
        print "Found";
    }
}
closedir($handle);

If you also wanted to check if the file WAS a JPG, then your could add the
following to the if statement:

    if ($img=getimagesize($file)) {
        if ($img[2]==2) {
            print "JPG";
        } else {
            print "Not a JPG";
        }
    } else {
        print "No a graphic at all";
    }





"Afan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi to all,
> how can I search folder with images for the image some_name.jpg and find
> does it exist or not?
>
> Thanks for any help!
>
> Afan
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to