Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP questions

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
greetings all,

Yes, I know, a stupid subject!! ;)

Anyhow.. what is the best way to store a directory structure in?
I wish to do a recurise search in php and store the directory structure in a good way, that is also easy to extract the information from, so that I may display the directories on the page...

Furthermore, chars such as ' and 3 swedish chars always destroy my code when using following code to download:
<?
$file = &quot;<root>&quot;.$_GET['ul'];
header (&quot;Content-type: octet/stream&quot;);
header (&quot;Content-disposition: attachment; filename=&quot;.basename($file).&quot;;&quot;);
header(&quot;Content-Length: &quot;.filesize($file));
readfile($file);
exit;
?>
I know that ' is used for strings and such things.. but is there a way around this so that files containing ' chars WILL be displayed? and Is there another download-way to make it work? or a way to make my server/php compatible with the swedish language?

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Wouldn't you store the directory structure in a multidimensional array?
You can have it be associative with keys named after the directory name.

You could also store the information in a thread like fashion, with id's and parentID where the tree can be assembled by nodes.

 
hrm.. is there anyway you could point to a tutorial, or should I do an all night search for it ;)

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top