Jump to content

match files


dreamwest

Recommended Posts

Im trying to only select files with a .jpg extension in a directory. Also i need to kill the script if it doesnt have any files with this extension in it.

 

Heres what ive got so far

$dir = '/home/user/public_html/pics/';

foreach(scandir($dir) as $file){

//kill the script if no files
if ($file< 0){
echo "No files";
die();
}

//if $file has a .jpg extension do something here


}

 

 

Link to comment
https://forums.phpfreaks.com/topic/163863-match-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.