Hi,
ok, here is the code:
<?
//starting directory
$startDir = "/homepages/24/d11622983/htdocs/Berent/";
//open directory
$openDir = opendir($startDir);
print "<center>";
print "<table border=0 cellspacing=1 cellpadding=4>\n<tr>\n<td>\n";
//starting of table
print "<font>Files</font>";
print "<table border=1 cellspacing=2 cellpadding=4>\n"; //another table
//loop while there are still things to be read in directory
while($path = readdir($openDir))
{
//gets the base name of file
$file = basename($path);
//makes sure we dont we read the . and .. direcotry (current directory
and parent directory)
if($file!="." && $file!="..")
{
//if its not a directory print out the stats (can be changed for your
needs)
if(!is_dir($startDir."/".$file))
{
$fullDir = $startDir."/".$file; //full directory path of file
$statCheck = stat($fullDir); //keeps info on files
print "<tr><td>\n";
print "File Name: <a href=".$file.">".$file."</a>\n"; //link to
name of file
print "</td></tr>\n";
print "<tr><td>\n";
print "File Size (bytes): ".$statCheck[7]."\n    ";
print "</td></tr>\n";
print "<tr><td>\n";
include ('.$file..txt');
print "";
print "</td></tr>\n";
} //end if
} //end if
} //end while
?>
So, i have a table displaying whats contained inside a directory with file
names and file sizes. All the files are pdf files.
For each file in the directory i need to display some file info (split up into
three parts), the file info is just in a basic txt form, so it can be changed
into what ever is needed.
How do i display for example the three bits of file information (contained in
the corresponding file's txt file) into my table?
Can the txt files have the same name as the pdf files i.e. 3000.pdf -
3000.txt?
Thanks again for your help
P.Stevens
Jack Dempsey wrote:
> "is there a way"
> i'm sure there is, but you haven't given enough information to get much
> more of a response...
> show us some code, explain clearly and concisely what you're trying to
> do, and we might be able to help more...
>
> -jack
>
> p.s. and the quick answer is yes, you can read information from text
> files...read the documentation on fopen and other file manipulating
> functions at www.php.net
>
> Peter Stevens wrote:
> >
> > hi,
> >
> > I am a newbie to php, so bear with me.
> > I have a directory list script which i admit i didnt make myself, but i
> > did have a lot of help on.
> > What i want to do is, when the page makes the list (into a table, with
> > filename and file size) i want to include a file description and two
> > pieces of information about the file.
> > The file description and the 2 other bits of info are stored as .txt
> > files, for example we have a file called 3000.pdf, which contains a
> > report, 3000.txt contains the file description and other information.
> > Is there a way to include these 3 pieces of info from the .txt file into
> > my directory list?
> >
> > Many thanks in advance,
> > P.stevens
> > --
> > http://www.berent.dk
> > http://www.berent.de
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
http://www.berent.dk
http://www.berent.de
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]