Wampserver is not displaying images or videos. Permission issue?

24 views Asked by At

I have a question regarding PHP and Wampserver.

If one were to have a Wampserver, use PHP to scan a certain folder for all movie files and make it so all of the files loads up fully playable. Would this be possible? I have tried doing this with other files like images and what not, but the content is not loading on the localserver.(I can see that the files did get scanned and they are there, but they are not being shown, only their names). Permission issue? The Wampserver and the movie folder are on different drives(I do not want to move all my movies into the www folder).

Apologies in advance for my English and stupidity.

<?php
$folder = "A:/images/";

$files = scandir($folder);
$allowedExtensions = array("jpg", "jpeg", "png", "gif", "mp4", "webm");
foreach ($files as $file) {
    $extension = pathinfo($file, PATHINFO_EXTENSION);
    if (in_array(strtolower($extension), $allowedExtensions)) {
        if (in_array(strtolower($extension), array("mp4", "webm"))) {
            echo '<video controls>';
            echo '<source src="' . $folder . '/' . $file . '" type="video/' . $extension . '">';
            echo 'Your browser does not support the video tag.';
            echo '</video>';
        } else {
            echo '<img src="' . $folder . '/' . $file . '" alt="' . $file . '">';
        }
    }
}

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Movies</title>
</head>

<body>
  <div class="movies">
    <?php include 'scandir.php'; ?>
  </div>
</body>

</html>
0

There are 0 answers