You could use glob()
Here's an example:
<?php
foreach(glob("path/to/files/imagename.*") as $file)
{
// do something with the file here
echo $file;
}
Question
friends. I need to locate a file, stored in my site while using php and finding it with a part of its name. I cant locate it by its entire name because the php file cannot know its extension. It might be png and might be jpg.
How do I do that?
Solution
You could use glob()
Here's an example:
<?php
foreach(glob("path/to/files/imagename.*") as $file)
{
// do something with the file here
echo $file;
}
OTHER TIPS
You will want to look at glob
.