Welcome Guest, Not a member yet? Register   Sign In
get_dir_file_info issue
#3

[eluser]Блум[/eluser]
This is a simplified example with testing get_dir_file_info() and opendir():
Code:
class Foldertest extends Controller {

    private $folder = "data/imageBin/";

    function Foldertest () {
        parent::Controller();
        
        $this->load->helper('file');
    }
    
    function index() {
        $dirListArray = get_dir_file_info($this->folder);
        echo "Testing get_dir_file_info:\n";
        print_r($dirListArray);
        echo "\n\n\n";
        
        
        echo "Testing opendir:\n";
        $dirListArray = array();
        if ($handle = opendir($this->folder)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    if (is_dir($this->folder.$file)) $dirListArray[$i]['name'] = "+".$file;
                    else $dirListArray[$i]['name'] = $file;
                }
                $i++;
            }
        }
        print_r($dirListArray);
        echo "\n\n\n";
        
    }
}

And here is the result:
Quote:Testing get_dir_file_info:
Array
(
[IMG_8047.JPG] => Array
(
[name] => IMG_8047.JPG
[server_path] => /home/blum/web_service/inp/data/imageBin/IMG_8047.JPG
[size] => 212638
[date] => 1213602408
[relative_path] => data/imageBin/
)

[IMG_8051.JPG] => Array
(
[name] => IMG_8051.JPG
[server_path] => /home/blum/web_service/inp/data/imageBin/IMG_8051.JPG
[size] => 196861
[date] => 1213611361
[relative_path] => data/imageBin/
)

)



Testing opendir:
Array
(
[] => Array
(
[name] => +bbbbb
)

[1] => Array
(
[name] => +cccccccc
)

[3] => Array
(
[name] => +nnnnnn
)

[5] => Array
(
[name] => +aaaaaaaa
)

[6] => Array
(
[name] => IMG_8047.JPG
)

[7] => Array
(
[name] => IMG_8051.JPG
)

)

Obviously the folders in the first case are not listed, in the case with opendir the folders are properly listed (with "+" at the front)..
Is there something wrong with my code..?

Thanks


Messages In This Thread
get_dir_file_info issue - by El Forum - 06-16-2008, 03:11 AM
get_dir_file_info issue - by El Forum - 06-16-2008, 08:21 AM
get_dir_file_info issue - by El Forum - 06-17-2008, 01:01 AM
get_dir_file_info issue - by El Forum - 07-17-2008, 04:10 AM
get_dir_file_info issue - by El Forum - 09-24-2008, 12:27 PM
get_dir_file_info issue - by El Forum - 10-17-2008, 05:50 AM
get_dir_file_info issue - by El Forum - 10-17-2008, 05:57 AM
get_dir_file_info issue - by El Forum - 12-05-2008, 02:33 PM
get_dir_file_info issue - by El Forum - 02-09-2009, 03:28 PM
get_dir_file_info issue - by El Forum - 02-10-2009, 03:57 PM
get_dir_file_info issue - by El Forum - 04-13-2009, 09:41 PM
get_dir_file_info issue - by El Forum - 04-13-2009, 09:57 PM
get_dir_file_info issue - by El Forum - 04-13-2009, 10:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB