<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<h2>Daftar File</h2>
<p>Berikut adalah daftar file yang sudah ada di server untuk di di-download oleh user public.</p>
<p><a href="<?php echo base_url();?>upload/form"><button class="btn btn-primary"><span class="glyphicon glyphicon-cloud-upload"></span> Upload File</button></a></p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>Nama File</th>
<th>Ukuran File</th>
<th>Tanggal Upload</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<?php
$no=null;
$dir = "uploaded_file/";
if(isset($daftar_file)){
for($a=0;$a<count($daftar_file);$a++) {
if($daftar_file[$a]!='.' && $daftar_file[$a]!='..'){
$no++;
$file=$daftar_file[$a];
?>
<tr>
<td align="center"><?php echo $no;?></td>
<td><?php echo $file;?></td>
<td align="right"><?php echo number_format(filesize($dir.$daftar_file[$a])/1024,2,',','.');?> Kb</td>
<td><?php echo date ("d-M-Y H:i:s", filemtime($dir.$daftar_file[$a]));?></td>
<td align="center">
<a href="<?php echo $dir.$daftar_file[$a];?>"><span class="glyphicon glyphicon-cloud-download"></span></a>
<a href="<?php echo base_url().'upload/hapus/'.$daftar_file[$a];?>"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</tbody>
<?php
}
}
}
?>
</table>
</div>