Good morning. I need to bring the weight of each of the files (they are all images) that are inside a directory.
<?php
$directorio = "vistas/img/productos";
$scandir = scandir($directorio, 1);
?>
<div class="container">
<div class="col-12">
<ul>
<?php
foreach($scandir as $key => $value){
echo '
<li>
'.$value.' - '.filesize($value).'
</li>'
;
}
// anda bien si tomo un archivo o carpeta, pero no cuando hago el ciclo
echo '<span>File Size: '.filesize($directorio).'</span>'
?>
</ul>
</div>
</div>
If I remove the filesize it brings me all the files, that is, a list with the name of each one including its extension. The problem is that when trying to apply filesize to the value (to each result that the cycle brings me) then I get next to each file name:
Warning: filesize (): stat failed for (and here the name of the image)
What am I missing?