jacko310592 Posted November 11, 2009 Share Posted November 11, 2009 hey guys below is my code which uses the glob function to grab image file names and place them into a combo-box... <?php $files = glob("{*.JPG,*.jpg}", GLOB_BRACE); for ($i=0; $i<count($files); $i++) { $photoId = $files[$i]; $photoId = substr($photoId,0,-4); //used to remove file ext if (stristr($photoId, "[")===FALSE) //'[' is written within images filenames to mark images i dont want the code to output. echo ' <option value="'.$photoId.'">'.$photoId.'</option> '; } ?> can anyone think of a way in which this code can be althered to show an <option>no images found</option> if no files can be found within the directory/no files without the '[' can be found thanks guys Link to comment https://forums.phpfreaks.com/topic/181169-function-to-show-message-if-no-file-found/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.