I have a page in PHP that lists the files in a folder from a search. In the result has a link to the file in order to open it. However, it is not possible to open the listed files.
Code index.php
<form name="frmBusca" method="POST" action="buscar.php">
<input type="text" name="buscar">
<input type="submit" name="pesquisa" value="Buscar">
</form>
Code search.php
<?php
//Arquivo para buscar video dentro do explorer
$video = $_POST['buscar'];
$endereco = "C:/xampp/htdocs/www/";
$iterator = new DirectoryIterator($endereco);
foreach ( $iterator as $entry ) {
if( ($entry->getFilename()) == $video){
echo $entry->getFilename()," ";
$link = $endereco.$entry->getFilename();
echo "<a href='$link'>".$entry->getFilename()."</a>";
echo "<br>";
}
}
?>
<video width="320" height="240" controls>
<source src='<?php echo $link; ?>' type="video/mp4">
</video>