Warning: scandir(/game/c_images/album1584/): failed to open dir: not implemented in

Asked

Viewed 90 times

0

I am having these Warning while running this code on my localhost someone could give me some solution?

Thank you ^^

<?php
    $target = "http://localhost:8080/game/c_images/album1584/";
    $weeds = array('.', '..');
    $sucess = "";

    $directories = array_diff(scandir($target), $weeds);
    if (is_dir($target)) { 
    foreach($directories as $value)
    {
        $gifkill            = str_replace('.gif', '', $value);
        $gif2kill           = str_replace('.GIF', '', $gifkill);
        $uppercasewords     = ucwords($gif2kill);

        if(is_file($target.$value))
        {
            echo "INSERT INTO `holly`.`badge_definitions` (`code`, `required_right`) VALUES ('".$uppercasewords."', '');<br />";
            $sucess = true;
    }
    if($sucess == false){
        echo "Não foi possível executar";
    }else{
     echo "Show!!";
  }
}
}else{
    echo "nao deu";
}?>
Warning: scandir(http://localhost:8080/game/c_images/album1584/): failed to open dir: not implemented in C:\xampp\htdocs\game\c_images\album1584\badgedef.php on line 13

Warning: scandir(): (errno 2): No such file or directory in C:\xampp\htdocs\game\c_images\album1584\badgedef.php on line 13

Warning: array_diff(): Expected parameter 1 to be an array, bool given in C:\xampp\htdocs\game\c_images\album1584\badgedef.php on line 13
  • You are trying to access a directory from a URL?

  • even putting "C: xampp htdocs game c_images album1584" does not solve

2 answers

0

Good afternoon, Caio, dear! You’re trying to manipulate files, right? The error is caused by the reason you access the file directly from the url, which could be done if accessed directly using the project folders. The "require" command could help. Example: $target = require('path to file')

0

You are trying to check if $target is a folder, but you have defined it as a link. In this case, $target must be $target = ". /game/c_images/album1584/"; if the game folder is in the same folder as your php document.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.