Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > PHP
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 08-16-2005, 06:31 PM   #1 (permalink)
salmanjoo
Registered User
 
Join Date: Aug 2005
Posts: 18
salmanjoo is on a distinguished road
Question want to get directory files and folders in list box

hi fellows
i have now another problem i want to make an controle panel like thing
for that i have to bring all the list of files and folders in list box so tell me how to do this plz
thanks
__________________
salmanjoo is offline   Reply With Quote
Old 08-16-2005, 09:26 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
you might wanna read up on opendir(), readdir() and closedir() for comparison you could take a look at my implementation as a C-program
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-17-2005, 03:39 PM   #3 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 595
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Here's something I used for a quick equivalent of unix's find.
PHP Code:
function scanDir2($workdir$startdir) {
  
$workdir "$startdir/$workdir";
  echo(
"<UL>\n");
  
$DIR opendir("$workdir");
  while(
$tmpname readdir($DIR)) {
  if (
preg_match('/^\.+/'$tmpname) == true) {
    
next;
   }
   elseif (
is_dir("$workdir/$tmpname")) {
     echo(
"<LI>\n"); 
     
scanDir2("$wordir$tmpname"$workdir);
     echo(
"</LI>\n");
    }
   else {
     echo(
"<LI>$tmpname</LI>\n");
   }
  }
  
closedir($DIR);
  echo(
"</UL>\n");

At the end you get a bunch of nested unordered lists. You would have to change this to selects and full paths insead of nested lists but the principle is the same.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating tree control with specified directory folders and files HanaDin Platform/API C++ 2 07-14-2004 05:16 PM
Installing and using CMUgraphics library. Valmont Standard C, C++ 12 03-29-2003 08:39 AM


All times are GMT -8. The time now is 02:12 AM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle