Jump to content

[SOLVED] Show images that are listed in directory


pcw

Recommended Posts

Hi, I am having a problem with the following script. It prints out the filename for each of the images in the directory but just shows a red cross instead of the image.

 

When I click on properties on the right click menu of the red cross, it shows the wrong directory path. I dont know why, and cant work out how to fix this :(

 

<?php
$username = "paul2";
$path = "../../members/uploads/$username/";
$dir_handle = @opendir($path) or die("Unable to open folder");

while (false !== ($file = readdir($dir_handle))) {

if($file == ".")
continue;
if($file == "..")
continue;

echo "<form action=img.php method=POST>";
echo "<input type=CHECKBOX name=$file>";
echo "<img src='$file' alt='$file'><br />";
echo "<input type=submit name=delete value=Delete>";
echo "</form>";
}
closedir($dir_handle);

?>

 

The code for this is different from an earlier post I made for showing an image for each upload and I cannot use it to solve this problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.