Welcome Guest, Not a member yet? Register   Sign In
File browser
#1

[eluser]r.i.p[/eluser]
Hello,

I want to do a file browser using CI. I wan to list all files and direcotries in a folder. Files and folders are presented as links (to a file or subfolder). Clicking on the folder link will take us to a subfoder and list its content. How would You do that ? Insert direstory structure in the databse and build links or maybe use only file system functions ? How can I do this usung CI ?

thanks for advices!
#2

[eluser]designfellow[/eluser]
Hi,

1. Use directory helper's directory_map() function to list all files and folders. it will list all files & folder in array.
2.Loop thru the array & use url helper's anchor function to create link in the same name
3.pass the directory name in url & receive it, do the same thing (may be a function to do this repeatedly)

Happy Coding,
DesignFellow
#3

[eluser]Derek Allard[/eluser]
CI has directory helpers and file helpers that should help here. Start by trying to simply display ever file you want in your browser to screen. After that, link them up. After that you can decide if its appropriate to build a data structure in your db or something, but start simple.
#4

[eluser]r.i.p[/eluser]
Hello,

Before I read Yours tips, I was wondering all the time, how to do this. The best part of this is that I started from simple file displaying and ended on bulding links using file and directory helpers. Now I know I'm going in the right direction. Thanks for help ! Smile
#5

[eluser]r.i.p[/eluser]
I have directory structure like this:

<htdocs>
|-my_project
|-system
|-application
|-controllers
| |-file_browser.php
|
|-my_files

I want to point relative path to directory in directory_map() function (in file_browser.php controller). I'm doing this by: $map = directory_map('../my_files/');

To check if it's mapped correct I use: print_r($map), but nothing is showing up. What am I doing wrong ?
#6

[eluser]attos[/eluser]
I used a jQuery plugin (jQuery File Tree). The download file comes with a PHP example that can be adapted to CI.
The project page is at: http://abeautifulsite.net/notebook.php?article=58
#7

[eluser]Unknown[/eluser]
@attos, can you please give an example of how you were able to implement the jQuery File Tree with Code Igniter? I am running into a few hurdles in implementing this within the Code Igniter framework.

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB