Upload Images Improvement

Discussion in 'PHP' started by lucreacia, Nov 19, 2012.

  1. #1
    I am working on a site that allows users to upload images into my directory and then a PHP code searches the folder the images are saved to and displays them:

    </style><?php$dir = "./";


    if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {


    echo '<img src ="'.$dir.$file.'"> <br><br><br>';


    }
    closedir($dh);
    }
    }
    ?>


    The only problem is that in order to view the images after uploading, the user has to click the link to the gallery instead of instantly being taken there, and then the photos are displayed in a single line down the page. How do I make the site instantly load the gallery page after an upload, and how to I make the photos more organized than in simply in a line?
     
    lucreacia, Nov 19, 2012 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    You should be able to modify the file upload script to respond with a redirect to the gallery page using the header() function in PHP.
     
    rainborick, Nov 19, 2012 IP