Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-17-2009, 09:06 PM List Folders Only
Super Talker

Posts: 115
Name: Not Telling
Trades: 0
I would like to only show folders, not the files.

It is showing me files and folders.

PHP Code:

PHP Code:
<?php 
function populateDropdown(){ 
$path glob("/home/bucket/public_html/*"); //the double \\ is not a typo you 
//have to escape it 
//if the path cannot be found 
if(!($path)){ 
echo(
"The path cannot be found"); 
return; 
}
//if 

//the path is valid 
else{ 
foreach(
$path as $i){ 

echo(
"<option value=$i>$i</option>"); 

}
//foreach 
}//else 
}//populateDropdown 

?>
Code:
<select> <?php populateDropdown(); ?> </select>
__________________
MY MSN:
Please login or register to view this content. Registration is FREE

PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
PM me anytime for HTML, PHP or web design help. I will be glad to help you out.

Last edited by sith717; 11-17-2009 at 09:08 PM..
sith717 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-17-2009, 10:22 PM Re: List Folders Only
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
Read the doc: http://php.net/manual/en/function.glob.php

PHP Code:
$path glob("/home/bucket/public_html/*"GLOB_ONLYDIR); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 11-19-2009, 08:34 AM Re: List Folders Only
Super Talker

Posts: 139
Name: John Davis
Trades: 0
You may use opendir(),readdir(),closedir() and is_dir()to get list of folders
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Reply     « Reply to List Folders Only
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23172 seconds with 12 queries