Jump to content

code to display images from directory not working


sid0972

Recommended Posts

i have a script to allow each member to store images in a folder named after him, so that they are exclusive to that particular member only.

 

Now when i try to retrieve it, i get error.

any ideas what might be wrong here??

 

 

<?php
session_start();
$pictures = glob("./uploads/".$_SESSION['valid_user']."/");
$no_pictures = count($pictures);

for( $i = 0; $i <= $no_pictures; $i++)
{
echo "<img src=\"".$pictures[$i]."\" />\n";
}
?>

 

thanks

This is the error

PHP Notice:  Undefined index: valid_user in /var/www/work/fns/display_images.php on line 3
<img src="./uploads/" />
PHP Notice:  Undefined offset: 1 in /var/www/work/fns/display_images.php on line 7
<img src="" />

 

i think its not accepting the session variable.

and i'll try hardcoding the username this time.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.