★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/002420.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Directory browsing

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Directory browsing
jgagner
Member
posted August 14, 2000 03:41 PM     Click Here to See the Profile for jgagner   Click Here to Email jgagner     Edit/Delete Message Reply w/Quote
I am testing a script for a futer project and it involves uploading a file and browsing a directory. I have a script that worked on my other system. When I go to view files in the directory, I get an empty page (excetpt for my echo statment). I don't get any error messages (I put in or die statements still nothing). There are files in the directory. I just don't get it! Here's my code

code:

$form = "<form enctype= \"multipart/form-data\" method=\"post\" action=/old?u=http%3A%2F%2Fwww.devshed.com%2FTalk%2FForums%2FForum5%2FHTML%2F%5C&y=1999"$PHP_SELF?process=upload\">
<input type=\"file\" name=\"file\" size=\"30\" >
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"25000\">
<input type=\"hidden\" name=\"username\" value=\"admin\">
<input type=\"submit\" value=\"Upload\">
</form>
";
$otheroptions = "<a href=/old?u=http%3A%2F%2Fwww.devshed.com%2FTalk%2FForums%2FForum5%2FHTML%2F%5C&y=1999"$PHP_SELF?process=view\">View Files in directory</a>";

switch ($process){
case "upload":
header("Location: http://www.bohampro.net/dev/upload/upload.php3?process=view");
copy("$file","$file_name.$username"); //Insert the file

break;
case "view":
echo "<html><head><title>Viewing Files</title>";
echo "</head><body>Files in /home/boham/./www/dev/uploads/";
$ddir = @opendir("/home/boham/bohampro-www/dev/upload/");
readdir($ddir) or die("Cannot read the dir"); //read the contents
closedir();
echo "</body></html>";
break;
default:
echo "<html><head><title>Sample upload script</title></head>";
echo "<body>";
echo '<h1 align="center">Upload script</h1>';
echo "$form";
echo "</body>";
echo "</html>";

};
exit(); // although useless, I use it just in case!
?>


Thanks a whole heap!

jgagner
Member
posted August 14, 2000 03:47 PM     Click Here to See the Profile for jgagner   Click Here to Email jgagner     Edit/Delete Message Reply w/Quote
The file uploads and I can download it, I just can't brows the directory.

jgagner
Member
posted August 14, 2000 04:53 PM     Click Here to See the Profile for jgagner   Click Here to Email jgagner     Edit/Delete Message Reply w/Quote
I fixed it. Never Mind.

------------------
Jerome Gagner

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.