Welcome Guest, Not a member yet? Register   Sign In
get_dir_file_info('path/to/directory/') information
#1

[eluser]henrihnr[/eluser]
Dear CI user..

I have difficulties in reading information from -> get_dir_file_info('path/to/directory/')

In user guide, it is written -> Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions. Any sub-folders contained within the specified path are read as well.

I don't understand the date variable
here's result i've got:

Code:
Array
(
    [file.xls] => Array
        (
            [name] =>
            [server_path] => C:\wamp\www\CodeIgniter\uploads\file.xls
            [size] => 22016
            [date] => 1225415343
            [relative_path] => uploads
        )
)

can anyone help me..thx
#2

[eluser]fesweb[/eluser]
That date is a php/unix timestamp, and there are lots of options for dealing with date formatting.

- You can load the CI Date helper and then use the unix_to_human() function.

- Or learn how to format dates using php date(). Simple example:
Code:
echo date('m/d/Y'); // would print today's date as 10/30/2008

// if you pass it your date variable, see what you get
$my_unix_date = $file_info['date'];
echo date('m/d/Y', $my_unix_date);
#3

[eluser]henrihnr[/eluser]
Nice.. thats really help me..thx




Theme © iAndrew 2016 - Forum software by © MyBB