sid0972 Posted February 11, 2013 Share Posted February 11, 2013 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 Link to comment https://forums.phpfreaks.com/topic/274364-code-to-display-images-from-directory-not-working/ Share on other sites More sharing options...
Kingy Posted February 11, 2013 Share Posted February 11, 2013 Are your session variables getting set? If you hardcode a username (./uploads/user/) does it work? Link to comment https://forums.phpfreaks.com/topic/274364-code-to-display-images-from-directory-not-working/#findComment-1411843 Share on other sites More sharing options...
Barand Posted February 12, 2013 Share Posted February 12, 2013 What error? Telling us just may speed up the help process. Link to comment https://forums.phpfreaks.com/topic/274364-code-to-display-images-from-directory-not-working/#findComment-1411926 Share on other sites More sharing options...
sid0972 Posted February 12, 2013 Author Share Posted February 12, 2013 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. Link to comment https://forums.phpfreaks.com/topic/274364-code-to-display-images-from-directory-not-working/#findComment-1411974 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.