/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] GLOB…Help Needed

[code=php]
$glob = glob($uploaded_dir.”*.jpg”);
[/code]

need help, sometimes the uploaded jpg’s extension is .JPG all uppercase so I need to make above code non case sensative. Thanks in advance.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@SheldonJun 11.2007 — can you not [url=http://php.net/sttolower]strtolower()[/url] the file name when you upload the image?
Copy linkTweet thisAlerts:
@FusionComputersJun 11.2007 — [code=php]
$extension = strtolower("*.jpg");
$glob = glob("$uploaded_dir . $extension");
[/code]

Maybe something like that?
Copy linkTweet thisAlerts:
@SheldonJun 11.2007 — [code=php]
$extension = strtolower("*.jpg");
$glob = glob("$uploaded_dir . $extension");
[/code]

Maybe something like that?[/QUOTE]



That wont work.

this may [code=php]
$glob = glob($uploaded_dir . "*.jpg|*.JPG");[/code]
Copy linkTweet thisAlerts:
@FusionComputersJun 11.2007 — Haven't used the glob function yet. I tried... :p
Copy linkTweet thisAlerts:
@SheldonJun 11.2007 — or [code=php]
<?php

function showdir($source){
if($handle = opendir($source)){
while(false !== ($file = readdir($handle))){
if($file != "." && $file != ".."){
if(preg_match('/^(.*)(.(?:jpg|jpeg|gif|png))$/i', $file)){
echo ("{$file} <br />"."n");
}
}
}
closedir($handle);
echo("End of Dir");
}
}

showdir("/images/uploaded/");

?>[/code]
Copy linkTweet thisAlerts:
@robertketterauthorJun 11.2007 — Thanks to all.... Sheldon is the winner this round. Your second answer is the best way I can see to do it.

PS...The images are ftp'ed automaticly late at night from my customer computers and I can't control the case of the ftp'ed files. The indexing on the websites is totally automatic. thanks again to all
×

Success!

Help @robertketter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...