make listed files a link

Hello people,

I’m the biggest noob around here and would really aprisiate some help if possible.

I have created a website that look like this:
http://www.planet-zix.se/video/
and I managed to list the files in the upload folder.
with:

<?php
$dir = dir("upload");

while (($file = $dir->read()) !== false)
{
echo "Video name: " . $file . " <br /> ";
}

$dir->close();

?>

Now I want them to be a links to a site that looks like this:
http://www.planet-zix.se/video/video.htm

so every file in the list automaticly opens a site and shows the right video.

if you cant help then please give me a hint or a dumb answer and I might figure it out myself hehe ;)

use…
[php]

<?php $dir = dir("upload"); while (($file = $dir->read()) !== false) { if($file[0]!='.') echo 'Video name: ' . $file . '
'; } $dir->close(); ?>

[/php]
… to get rid of the ‘…’ and ‘.’ as well

now rename video.htm to video.php

and in there use:

<PARAM NAME="FileName" VALUE="<?php echo(urlencode(basename($_GET['video']))) ?>">

and

<EMBED TYPE="application/x-mplayer2" SRC="<?php echo(urlencode(basename($_GET['video']))) ?>" NAME="MediaPlayer" WIDTH="800" HEIGHT="600" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0">

http://php.net/urlencode
http://php.net/basename
http://php.net/variables.external

Thank you very much for your time and teaching me this.

it almost works perfecktly =)

its just that the video wont play when I klick play now.

hope u have seen that i have forgotten the path:
SRC=“upload/<?php echo(urlencode(basename($_GET['video']))) ?>”
NAME=“FileName” VALUE=“upload/<?php echo(urlencode(basename($_GET['video']))) ?>”>

Sponsor our Newsletter | Privacy Policy | Terms of Service