Current location: Hot Scripts Forums » General Community » Script Requests » List Everything In Folder (PHP)


List Everything In Folder (PHP)

Reply
  #11 (permalink)  
Old 03-14-06, 04:39 PM
Barnz1986 Barnz1986 is offline
Aspiring Coder
 
Join Date: Jan 2006
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by IKG
@ Mab: I tried what you suggested and got the "could not open" error listed. I also tried making it just "endicott/" but no luck...
Well the path to your directory must be wrong then.
Reply With Quote
  #12 (permalink)  
Old 03-14-06, 06:40 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
If you wanted to list the files in the current folder (where this php script is located/running from) you would use this -
PHP Code:

$dirname "."
If your images folder (and the other sub folders within it) are located within the current folder, you would use this -
PHP Code:

$dirname "./images/personal/endicott/"
This would also work -
PHP Code:

$dirname "images/personal/endicott/"
If your images folder is located one level closer to the root, you would use this -
PHP Code:

$dirname "../images/personal/endicott/"
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #13 (permalink)  
Old 03-14-06, 06:58 PM
IKG IKG is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Still doesn't work


Here's how my directory is set up: www.websitename.com/images/personal/endicott

I placed the .php file inside the endicott folder. I don't know what else to say.
Reply With Quote
  #14 (permalink)  
Old 03-14-06, 07:16 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
If the .php file is in the same folder that you want to display the files in, the first form will work - $dirname = ".";

What is it doing or not doing?

A function like the opendir($dirname) is pretty basic. If it is not working, there could be a permissions problem with the folder(s) or you have a problem with PHP functioning.

P.S. Use the "." form with a trailing slash - $dirname = "./"; Code that uses this later in the loop needs a trailing slash to form the link.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???

Last edited by mab; 03-14-06 at 07:21 PM.
Reply With Quote
  #15 (permalink)  
Old 03-22-06, 03:42 AM
wirenut60 wirenut60 is offline
Newbie Coder
 
Join Date: Feb 2006
Location: Lawrenceburg Tennessee
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
php directory lister

I posted this in another subject.

http://freepgs.com/bawbaw60/zip/html...lister-php.txt

Wirenut
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
Drop down list change PHP ancdy PHP 5 02-10-05 05:33 AM
Create List with PHP ...? demnos PHP 6 08-13-04 02:40 PM
edit php in Squirrelmail jrcortrightiii PHP 1 07-10-03 02:08 PM


All times are GMT -5. The time now is 11:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.