473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Generating listing of directory

Hi -
I'm hoping for help with the auto-generation of a hyperlinked listing
of all files in a directory. The server I use does not auto-generate
this. So, when someone comes to this directory and thus opens
index.htm, I want that file to show a listing of all files in the
directory with hyperlinks to them.

Thanks for the help,
Doug

Nov 12 '06 #1
3 1545
do********@gmail.com wrote:
I'm hoping for help with the auto-generation of a hyperlinked listing
of all files in a directory. The server I use does not auto-generate
this. So, when someone comes to this directory and thus opens
index.htm, I want that file to show a listing of all files in the
directory with hyperlinks to them.
You can try something like this:

http://www.evoluted.net/community/co...orylisting.php

--
http://www.phpwebdir.com
Nov 12 '06 #2
<comp.lang.php>
<do********@gmail.com>
<11 Nov 2006 22:01:01 -0800>
<11**********************@k70g2000cwa.googlegroups .com>
I'm hoping for help with the auto-generation of a hyperlinked listing
of all files in a directory. The server I use does not auto-generate
this. So, when someone comes to this directory and thus opens
index.htm, I want that file to show a listing of all files in the
directory with hyperlinks to them.
This only shows .jpg files , Remove the (if stuff) from the following to
display everything .
<html>
<head>
<title>?</title>
</head>
<body>
<?php
$batman=0;
$dir="chatroom/images";
$joker=opendir($dir);
while (false!==($boywonder=readdir($joker)))
{
$files[]=$boywonder;
$batman=$batman+1;
}
$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen($demo);
$penguin=substr($demo,$riddler-4,4);
if ($penguin==".jpg")
{
$link="$dir" . "/" . "$demo";
print "<a href=$link>$demo</a><br>";
}
$temp=$temp+1;
}
?>
</body>
</html>
--
www.phpchatroom.co.uk
Nov 12 '06 #3
Thank you all - I very much appreciate it.

Doug

Krustov wrote:
<comp.lang.php>
<do********@gmail.com>
<11 Nov 2006 22:01:01 -0800>
<11**********************@k70g2000cwa.googlegroups .com>
I'm hoping for help with the auto-generation of a hyperlinked listing
of all files in a directory. The server I use does not auto-generate
this. So, when someone comes to this directory and thus opens
index.htm, I want that file to show a listing of all files in the
directory with hyperlinks to them.

This only shows .jpg files , Remove the (if stuff) from the following to
display everything .
<html>
<head>
<title>?</title>
</head>
<body>
<?php
$batman=0;
$dir="chatroom/images";
$joker=opendir($dir);
while (false!==($boywonder=readdir($joker)))
{
$files[]=$boywonder;
$batman=$batman+1;
}
$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen($demo);
$penguin=substr($demo,$riddler-4,4);
if ($penguin==".jpg")
{
$link="$dir" . "/" . "$demo";
print "<a href=$link>$demo</a><br>";
}
$temp=$temp+1;
}
?>
</body>
</html>
--
www.phpchatroom.co.uk
Nov 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Kim Jensen | last post by:
I'd like to make a directory listing where instead of the entire filename I need it to show the filename minus the extention and get the value of charname= in the file itself. I've been told...
19
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
2
by: Tom | last post by:
I need to get a directory listing through http. If I put the directory path in the browser address bar such as http://somewebpage.com/subdir I get the listing of the directory. Of course this is...
8
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir)...
2
by: ngr | last post by:
I used to use the DirListox control in VB6 but this is no longer supported in VB.NET. What I want to do: I want to take a directory listing and show any subdirectories in a list. When you click...
8
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
7
by: epikto | last post by:
I have a mapped share that I am trying to get a listing of all the files that it contains. I use the following code to access the contents String files = Directory.GetFiles(path); I can then...
4
by: techusky | last post by:
I have a *very* simple script written that displays the directory listing of the current working directory, but I am having some difficulty when I try to change folders. Basically, I have my $dir...
5
by: jain236 | last post by:
HI every body, i am always getting the following error while parsing a directory . i am reading a directory by doing ls and trying to find out the name,type,size, mtime and mode of files from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.