#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    14
    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

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    $form = "<form enctype= "multipart/form-data" method="post" action="$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="$PHP_SELF?process=view">View Files in directory</a>";

    switch ($process){
    case "upload":
    header("Location: <A HREF="http://www.bohampro.net/dev/upload/upload.php3?process=view");" TARGET=_blank>http://www.bohampro.net/dev/upload/upload.php3?process=view");</A>
    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!
    ?>
    [/code]

    Thanks a whole heap!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    14
    The file uploads and I can download it, I just can't brows the directory.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    14
    I fixed it. Never Mind.

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

Similar Threads

  1. JS src="GENERATOR" / directory browsing
    By RoaringSeb in forum HTML Programming
    Replies: 1
    Last Post: January 17th, 2004, 03:59 AM
  2. Deny directory browsing on apache with .htaccess?
    By stojan in forum Apache Development
    Replies: 2
    Last Post: December 3rd, 2003, 11:54 AM
  3. PHP directory browsing, on the fly thumbnails
    By deanbayley in forum PHP Development
    Replies: 3
    Last Post: October 24th, 2003, 10:01 AM
  4. VirtualHost directory browsing problem
    By JackOnline in forum Apache Development
    Replies: 3
    Last Post: September 18th, 2003, 12:58 PM
  5. limit directory access without password
    By MisterHeadache in forum Apache Development
    Replies: 0
    Last Post: August 11th, 2003, 01:13 PM

IMN logo majestic logo threadwatch logo seochat tools logo