3
I have the following code
<?PHP
$directory = "placas";
//Get each file and add its details to two arrays
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess"){
$currentModified = filectime($directory."/".$file);
$file_names[] = $file;
$file_dates[] = $currentModified;
}
}
closedir($handler);
if(substr($file_dates[0],0, -2)==substr(time(),0, -2)){
echo "confere no BD se existe a placa ". $file_names[0];
}
echo "<meta http-equiv='refresh' content='2;url=identificar_placa.php'>";
?>
the variable "directory" is containing the folder "boards", however,I want to modify to a directory that is in another path, more specifically in "C: xampp htdocs boards", I tried to put $directory = "C: xampp htdocs boards"; and it didn’t work.
It didn’t work. The if to test if the directory exists works with any other directory I put, except the boards folder inside the xamp/htdocs. Is it because it’s inside XAMP or something like that?
– Deyci
When you say that it does not work it is because you have displayed the message "The $directory folder does not exist", or it is because it has given error?
– Wictor Chaves
Why did the message appear that the directory does not exist...
– Deyci
The folder C: mpp htdocs boards does not exist
– Deyci
Try putting the url this way: "C:/xampp/htdocs/boards"
– Wictor Chaves
That was it... funny that I was copying the address... Thanks!
– Deyci
It is complicated to use this bar because it is used for some things like n line break or t tab, it is possible that x do something too, here came the problem.
– Wictor Chaves
I did some testing here too, with simple quotes also works 'C: xampp htdocs boards'
– Wictor Chaves
php is crazy too kkkkkkkkkkkkkk the program was working before I changed the directory, changed, tested, worked. Now it’s not working anymore, not even with the original code.
– Deyci
Let’s go continue this discussion in chat.
– Wictor Chaves