Hey guys.
I am working on putting together a back-end for a website I am working on and am making an image uploading script. Below is the script that is supposed to display all of pictures in a set folder.
PHP Code:
<?
//define the path as relative
$path = "../images/news/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing<br/>";
//echo "<iframe scrolling='yes'>";
while ($file = readdir($dir_handle))
{
if(filetype($path.$file)=="file")
echo "<div style='width:320px; border:1px solid green; clear:both;'>";
echo "<div style='width:100px; float:right;'><a href='JavaScript:void(0);' onclick='copy(\"http://www.lauriernetimpact.com/images/news/".$file."\");'>Copy Link to Clipboard</a><br /><br /><a href=''>Delete</a></div>";
echo "<img height='100px' src='../images/news/".$file."' alt='Image' />";
echo filetype($path.$file);
echo "</div>";
}
//closing the directory
closedir($dir_handle);
?>
The issue is that its also echoing out the information for the directories. I thought by including the if statement I would avoid that but it doesnt seem to be working at all. The strange thing is that the directories don't have the test border around them like the normal images, and they don't group with the images either.
Its in a protected directory so if my explanation sucked I can move it to an open directory so you all can actually look at it.
Thanks
__________________
DVD Movie Release Database: Please login or register to view this content. Registration is FREE
|