I am dealing with an online telephone directory. I will have a folder that contains hundreds of advertising images. Each IMAGE name will have a 6 digit number (somewhere within the file name) that corresponds to the ad_name field in my main database. These image files will be either JPG, GIF, or PNG (but will all have the same extension)
In my listing data, any listing that contains a display ad (an image) will have an "ad_name > 0"
For example if Joe's Auto purchased a display ad, his listing data would contain a number like 112534 in the ad_name field. That is a system generated ad name.
When we create the IMAGE, we MUST include that series of numbers somewhere in the file name. So we would create an image file named something like this:
joes_auto_112534.jpg, or 112534_joes_auto.gif.
What i need to figure out is... if I run acrosss a listing that has an ad_name greater than zero - that customers purchased an ad, and a file exists on the server that has the ad_name entry somewhere in the file name - how do I find THAT file and return ONLY the file name - not the path?