This file returns a list of filenames to help populate a drop down in my form. For some reason it ignores any file names that begin with numbers, could anyone please tell my why and show me how to solve it?
Code: <?php
function buildFileList5($theFolder, $value) {
// Execute code if the folder can be opened, or fail silently
if ($contents = @ scandir($theFolder)) {
// initialize an array for matching files
$found = $output = array();
// Create an array of file types
$fileTypes = array('jpg','jpeg','gif','png','JPG');
// Traverse the folder, and add filename to $found array if type matches
$found = array();
foreach ($contents as $item) {
$fileInfo = pathinfo($item);
if (array_key_exists('extension', $fileInfo) && in_array($fileInfo['extension'],$fileTypes)) {
$found[] = $item;
}
}
// Check the $found array is not empty
if (!empty($found)) {
// Sort in natural, case-insensitive order, and populate menu
natcasesort($found);
//$selectedImage = ""; //default image
foreach ($found as $filename){
$sel = ""; //reset $sel
$selectedImage = ""; //default image
if($value == $filename) {
$sel = "selected="selected"";
$selectedImage = $filename;
}
$output[] = "<option value="$filename" $sel>$filename</option>n";
}
}
return (empty($output) ? '<option value="-1">No Items Found in `'.$theFolder.'`</option>' : '<option value="-1">Please select an Item</option'."n".join("n",$output));
}
}
?>
Thanks a million for any help on this
What do you call the "token" thing?
You know how some sites have links that run on tokens? Tokens are links that only stay alive for a certain amount of time (1 use, 1 day, 1 week, etc).Can someone explain to me what exactly it's
PHP page is blank
Hi Everyone,I have a site in which I am able to open the first PHP webpage in my browser but when I start navigating the site, another webpage doesn't open. The page is totally blank for this webpage.
How to add advertisment on top of videos
Hello,I was told that i should find the answer for this problem in this forums.I searched a lot but i couldnt find the solution .What i need to do is to add ads on top of the videos i have
php sessions,logouts & the bloomin back button!
Hi All,I've got a cms that members can log into. When they logout, the session is destroyed, however, if you click the back button, you can get back into the CMS.How can I get around this?My logout
Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my php/mysql social site*only for a USA town doesn't require non english characters*
line breaks in between fetched file names
Hi,I have this code:Code: <?php if($dir = opendir('files')){ while (($file = readdir($dir) )!== false){ if ($file !='.' && $file !='..'){ echo
Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and string function don't seem to work because they consider the Greek alphabet letters as part of the A-Z
Inserting a variable in a link
I have this code that I want to insert for my own variable but I have no idea how. This is what I want to insert:Code: <?php echo $my_twitter_username; ?>Into this code:Code:
How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignored, rejected, or misunderstood in this forum. I'm surprised there isn't already any
Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two values side by side like so $Fname $Lname. Where ever i use tag the values appear in the final