[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2849
  • Last Modified:

How do you use get_filenames or directory_map in codeigniter?

I'm new to codeigniter and php and am having a really hard time figuring out some of the helpers that don't include examples!

Can someone provide a few lines of code that would show how to use get_filenames or directory_map to echo the list of files in a specific folder?  No need to worry about subfolders as what I'm doing will not have any subfolders, only files.

Thanks!
0
lthames
Asked:
lthames
  • 2
1 Solution
 
04it040Commented:
you can use get_filenames function as following :-

NOTE: your apache user has to have  read access in the target directory.


Regarding  directory_map, its well explained in there documentation:-
http://codeigniter.com/user_guide/helpers/directory_helper.html
$this->load->helper('file');

$data = get_filenames('/var/www/html/');
print_r($data);


		

Open in new window

0
 
Mehul_PanchalCommented:
0
 
lthamesAuthor Commented:
Thanks.  the examples in the link helped me figure out what to do with the information once retrieved.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now