RE: [PHP-WIN] [PHP] Newbie qustion concening directories and files.

From: Date: Tue, 12 Sep 2000 22:55:54 +0000
Subject: RE: [PHP-WIN] [PHP] Newbie qustion concening directories and files.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2613@lists.php.net to get a copy of this message
Bummer. That didn't appear to be it. This is what I have now, how does it look to you? ========== <?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 ); ?> ========== Yrs, Michael WebFlyer Interactive Team ---------- 2428 Hall Ave. Grand Junction, CO. 81501 970.242.1163 Preferred 970.263.4201 Alternative > -----Original Message----- > From: Gonzalo Vera [mailto:gvz@eucalipto.net] > Sent: Tuesday, September 12, 2000 4:50 PM > To: Michael Elmore > Cc: PHP-Windows List > Subject: Re: [PHP-WIN] [PHP] Newbie qustion concening directories and > files. > Importance: High > > > Try using \\ (double-backslash) for directory names, since the > backslash is > the escape character. Something like: > > $somedirectory = opendir( "C:\\Xitami\\webpages\\php\\myadmin" ); > > Gonzalo. > > > Not getting much of a response to this question on the > "General" version of > > this list so I thought I'd try the windows version. I would > appreciate it if > > someone here had a direction I might try. Sorry that this posting is so > > long. > > > Thanks in advance. > > > Yrs, > > > Michael > > WebFlyer Interactive Team > > ---------- > > 2428 Hall Ave. > > Grand Junction, CO. 81501 > > 970.242.1163 Preferred > > 970.263.4201 Alternative > > >> -----Original Message----- > >> From: Michael Elmore [mailto:melmore@insideflyer.com] > >> Sent: Tuesday, September 12, 2000 1:02 PM > >> To: PHP-General List > >> Subject: [PHP] Newbie qustion concening directories and files. > >> > >> > >> 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 > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.windows (#2613) next »