battleroyalex Posted April 8, 2006 Share Posted April 8, 2006 Can someone help me with a php code that loads files from a folder and then prints out a url like this[code]www.mydomain.com/video?name="filenamehere"[/code]I don't even know where to start please point me in a direction, thanks guys Link to comment https://forums.phpfreaks.com/topic/6888-loading-files-from-a-folder-and-printing-them-out-as-links/ Share on other sites More sharing options...
battleroyalex Posted April 8, 2006 Author Share Posted April 8, 2006 anybody :( Link to comment https://forums.phpfreaks.com/topic/6888-loading-files-from-a-folder-and-printing-them-out-as-links/#findComment-25071 Share on other sites More sharing options...
stephenk Posted April 8, 2006 Share Posted April 8, 2006 Have a look at php.net/dirIt has all the commands and examples you could needStephen Link to comment https://forums.phpfreaks.com/topic/6888-loading-files-from-a-folder-and-printing-them-out-as-links/#findComment-25074 Share on other sites More sharing options...
mistergoomba Posted April 8, 2006 Share Posted April 8, 2006 [code] $handle=opendir('live/');$file = array();while($var = readdir($handle)){ if(is_file("live/".$var)){ array_push($file, $file0); }}[/code]Of course replace 'live/' with your directory. All file names will be in an array called $file. You can then pass the array through a loop to print out the links.[code]foreach($file as $k=>$v){ echo '<a href="video.php?filename=$v">$v</a>';}[/code][!--quoteo(post=362848:date=Apr 8 2006, 01:07 PM:name=battleroyalex)--][div class=\'quotetop\']QUOTE(battleroyalex @ Apr 8 2006, 01:07 PM) [snapback]362848[/snapback][/div][div class=\'quotemain\'][!--quotec--]anybody :([/quote]PS: This above example will not add '.' and '..' as filenames. Link to comment https://forums.phpfreaks.com/topic/6888-loading-files-from-a-folder-and-printing-them-out-as-links/#findComment-25076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.