php - Ajax Files browser ; What are the good practices -


i'm working on file browser (a ligth file manager if prefer) based on php , javascript.

i'm building treeview folders :

<ul id="treeview">     <li><a href="#">folder 1</a></li>     <li><a href="#">folder 2</a>         <ul>             <li><a href="#">folder 2.1</a></li>             <li><a href="#">folder 2.2</a></li>         </ul>     </li>     <li><a href="#">folder 3</a></li> </ul> 

each link represent folder. want here loading content of folder after cliking on it.

i have php code :

public function getcontent($path) {     //fetch content of $path directory } 

i have js code handle events :

$('#treeview a').live('click',function(e){     e.preventdefault();     var folder = //here : path     loadcontentinpanel(folder); }); 

but don't know how path of clicked folder safely. should add directly in attribute this? :

<li><a href="root/folder2/folder2.1/"> folder 2.1</a></li> 

ideally path not visible( not readable @ least) end user. thinking build link base64_encode() idea ?

thanks suggestions.

you're giving away path folder treeview, don't see problem adding actual element.

<li><a href="root/folder2/folder2.1/"> folder 2.1</a></li> 

will in

<ul id="treeview">//root     <li><a href="#">folder 1</a></li>     <li><a href="#">folder 2</a> //folder2 

perform security checks @ "getcontent" function , you'll fine.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -