<?php
require '../extentions/aws/start.php';
$objects = $s3->getIterator('ListObjects', [
  'Bucket'=>$config['s3']['bucket']
]);


 ?>

 <!DOCTYPE html>
 <html lang="en" dir="ltr">
   <head>
     <meta charset="utf-8">
     <title>Enlistar archivos</title>
   </head>
   <body>
<table>
  <thead>
    <tr>
      <th>File</th>
      <th>Last Modified</th>
      <th>Size</th>
      <th>Download</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($objects as $object):
      ?>
      <tr>
        <td><?php echo $object['Key']; ?></td>
        <td><?php $fecha = $object['LastModified'];
        $fecha = new DateTime($fecha);
        echo $fecha->format('d/m/Y'); ?></td>
        <td><?php $peso= $object['Size'];
        $peso=$peso/1024;
        echo intval($peso).' Kb';
        ?></td>
        <td><a href="<?php echo $s3->getObjectUrl($config['s3']['bucket'], $object['Key']); ?>" download="<?php $object['Key']; ?>"><?php echo $object['Key']; ?></a>
          </td>
      </tr>
    <?php endforeach; ?>
  </tbody>
</table>
   </body>
 </html>
