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 Quote Link to comment Share on other sites More sharing options...
battleroyalex Posted April 8, 2006 Author Share Posted April 8, 2006 anybody :( Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.