[email protected] Posted September 16, 2006 Share Posted September 16, 2006 hey so i have a working upload script, as well as a working user registration/login thing using mysql, but what i want to do now is have a "my uploads" page. which i believe i know kinda how to do. this is what i want:i also have a working "show file contents in directory" script, and i want to tweak it so that the directory will change depending on what user is looking at their upload page. because i am going to have a different upload directory per user. so like yea, how would i get it to do that?btw, here is my show directory script:Code:[code]<?php//tells which directory to open. this is probubly where the tweaked code will go, i dunno tho.if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "index.php" && !is_dir($file)) { // shows the file name, as well as a link to the file: echo "<a href='" . $file . "'>" . $file . "</a><br/>"; } } closedir($handle);}?>[/code] Link to comment https://forums.phpfreaks.com/topic/20990-a-my-uploads-page/ Share on other sites More sharing options...
[email protected] Posted September 16, 2006 Author Share Posted September 16, 2006 k i figured this out, so "$session['uname'] is the logged in username, and so thisis the code i made:[code]<?php//this is the new code, making it go to the username folder: $username = "uploads/users/" . $_SESSION['Uname'] . "/";//normal code, but replaced "." with $username, to get it to go to that folderif ($handle = opendir($username)) {//end of new code, beginning of normal showing directory code: while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "index.php" && $file != "upload.php" && $file != "index.html" && !is_dir($file)) { echo "<a href='" . $file . "'>" . $file . "</a><br/>"; } } closedir($handle);}?>[/code]but it outputs this:username1username2and then has a link to www.mywebsite.com/username1insted of showing the files in the www.mywebsite.com/uploads/users/username1/ directory.howdo i fix this? Link to comment https://forums.phpfreaks.com/topic/20990-a-my-uploads-page/#findComment-93174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.