You were right it was just a filename/directory name not an actual path.
PHP Code:
<?php
$dir = '/opt/lampp';
$files1 = scandir($dir);
?>
Directory <br />
<?php
foreach ($files1 as $fileobject){
$file = $dir . "/" . $fileobject;
if (is_dir($file)){
echo "$fileobject<br>";
}
}
?>
<br /><b>Files:</b><br />
<?php
foreach ($files1 as $fileobject){
$file = $dir . "/" . $fileobject;
if (is_file($file)){
echo "$fileobject<br>";
}
}
?>
<br /><b>File type:</b><br />
<?php
foreach ($files1 as $fileobject){
$file = "/opt/lampp/" . $fileobject;
echo "$fileobject : " . filetype($file) . "<br>";
}
?>
<br /><b>File Sizes:</b><br />
<?php
foreach ($files1 as $fileobject){
$file = "/opt/lampp/" . $fileobject;
echo filesize($file) . "<br>";
}
?>
This clearly shows what is a directory and what is a file.