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.'; } } Link to comment https://forums.phpfreaks.com/topic/182788-question/ 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.'" />'; } } } Link to comment https://forums.phpfreaks.com/topic/182788-question/#findComment-964806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.