<?php
// app/Controllers/LibraryController.php
namespace App\Controllers;
use CodeIgniter\Controller;
class LibraryController extends Controller
{
public function index()
{
helper('filesystem');
$directory = FCPATH . '/archive'; // Path to the library directory
// Check if the directory exists
if (is_dir($directory)) {
$data['files'] = directory_map($directory);
} else {
$data['files'] = [];
}
return view('library', $data);
}
}