Wednesday, 12 March 2014

Scan directory for files(not folders) and store them in array.



$files = array();
if ($handle = opendir ('dir_name')) {
    while ( false !== ($entry = readdir ($handle))) {
        $path_parts = pathinfo( $entry);
        if($path_parts ['extension'] !='' ){
            $files[] = $entry ;
            }
    }
  closedir( $handle);
}

No comments:

Post a Comment