Newbie qustion concening directories and files.
| From: | Michael Elmore | Date: | Tue, 12 Sep 2000 19:01:57 +0000 |
| Subject: | Newbie qustion concening directories and files. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16421@lists.php.net to get a copy of this message | ||
Hello everybody. Nice to be a part of your community. Thanks for allowing me
to post my questions here.
My first question may be more appropriate for the Windows version of this
list, and if any of you feel that this might be so, please let me know and I
will seek guidance there as well as here. I mention the windows list because
I'm developing on a Windows 98 box using the Xitami server. All seems to be
functioning pretty well for the most part but the code I'm working on now
seems to be giving me fits and I'm not sure why. This is just my
developement environment not the final environment where the scripts will
reside when I'm finished. That box is a SPARC running Solaris. I don't know
if any of this will have a bearing on your response so I thought it
appropriate to include it for my first posting here.
My eventual goal is this: I'm wanting to open a "directory" where several
thousand text files will reside, open each "file" individually, test for
content, and then print the contents to my browser if the content exists. As
a step in the right direction I wrote the following code which was just
supposed to retrieve every file in the directory and print the contents to
my browser window. I thought I'd write the testing in later.
Anyway, when I run the code I get the following error: "Parse error: parse
error in C:/XITAMI/webpages/php/test_opendir.php on line 24"
The code I've written is as follows:
============================================================================
=
<?php
// Open a directory.
$somedirectory = opendir( "C:\Xitami\webpages\php\myadmin" );
// Now get the name of each directory_file.
while( $entryname = readdir( $somedirectory ) )
{
if( is_link( $entryname ) )
{
print( "Sorry this isn't a file!\n" );
}
else
{
chomp( $entryname );
$incoming = fopen( "C:\Xitami\webpages\php\myadmin\$entryname", "r" ) or
die( "Can't open C:\Xitami\webpages\php\myadmin\$entryname" );
$filedata = fread( $incoming, filesize( $entryname ) );
print( "$filedata" );
}
// Close the directory.
closedir( $somedirectory );
?>
============================================================================
=
Sorry for the length of this post. I'll try and keep them smaller in the
future.
Thank you all for your help.
Yrs,
Michael
WebFlyer Interactive Team
----------
2428 Hall Ave.
Grand Junction, CO. 81501
970.242.1163 Preferred
970.263.4201 Alternative