ifubad Posted August 28, 2008 Share Posted August 28, 2008 Using the function readdir to get a list of files, and only if the file is a jpg, then those files will get stored into the array. Would it be correct to use regex to check the extension? Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 28, 2008 Share Posted August 28, 2008 You could, but it would probably be easier to just check the last 4 characters to see if they equal '.jpg' if (str_to_lower(substr($filename, -4))=='.jpg') { echo "It's a jpeg!"; } else { echo "It's NOT a jpeg."; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.