Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get File name from folder and put it in a querystring

Status
Not open for further replies.

chriszd

Technical User
Apr 21, 2008
42
MT
Hi Guys,

I managed to get the file names from a specific folder but i can't manage to make the query string work. The value is not going through the query string. (where the value i the file name)

--------------------------------------------------

$dir = "$useris/";
$count = count(glob($dir . "*"));

$good_ext = array(".jpg",".gif");

if ($handle = opendir($dir))
{
// test if count has found the files in the temp image dir.
echo "Total Number Of Pictures ";
echo $count;

while (false!== ($file = readdir($handle)))
{
echo "<td>";

$ext = strrchr($file,".");
echo "<br>";


if(in_array($ext,$good_ext))
{
// Open the folder for display
$dir_handle = @opendir($dir) or die("Unable to open $dir");

echo"$file <br>";
echo "<a href=userdeletephoto.php?DP=$file>Delete Photo</a><br>";


echo "<a href=\"$dir/$file\" title=$dir Pictures><img src=\"$dir/$file\" width=100 height=100 /></a> <br> ";

}
else
{

}
}
echo "</td>";
closedir($handle);
}
else
{
echo "User Still Didn't Upload any Pictures";
}
?>

------------------------------------------------

this is the part of the code.. where the value which should be the filename is not being sent via the Query String
 
Not sure what you are looking for but I changed one line of code and look OK for me

I changed
Code:
 echo "<a href=\"$dir/$file\" title=$dir Pictures><img src=\"$dir/$file\" width=100 height=100 /></a> <br> ";
to
Code:
echo '<a href="'.$dir.$file.'" title="'.$dir.$file.'"><img src="'.$dir.'/'.$file.'" width=100 height=100 /></a> <br>';
 
Thanks for your reply, i manged but to fix the problem..

i've used $file = urlencode()

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top