mrclark219 Posted November 24, 2009 Share Posted November 24, 2009 Ok, so I am a total newb at php but I have this upload script. It works just fine, it sends the file to the a subdirectory according to a corresponding part number. My question is could anybody point me in the direction of creating some type of link that users can get to the uploaded file from the page where the part number's! Thanks Here is what I have... $target = basename($_FILES['uploaded']['name']); // Assuming $fileDest is the base directory for your images // AND Assuming it already has the / on the end of it $dest = $fileDest . $partNumber . '/'; // Make the PartNumber directory if it is not already there if (!is_dir($dest)) { mkdir ($dest, $mode = 0777, $recursive = false); } // Move the uploaded file if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $dest . $target )) { echo "File uploaded!"; } else { $errMsg .= 'An unexpected error has occured. Please try again and contact the Information Management Systems Administrators if the problem persists.'; } } Quote Link to comment Share on other sites More sharing options...
flyhoney Posted November 24, 2009 Share Posted November 24, 2009 Try something like this: <?php $dirs = scandir("images/"); foreach ($dirs as $dir) { if ($dir == '.' or $dir == '..') continue; if (is_dir($dir)) { $images = scandir("images/$dir"); foreach ($images as $image) { echo '<img src="images/'.$dir.'/'.$image.'" />'; } } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.