Welcome Guest, Not a member yet? Register   Sign In
Cannot figure out helper FILESYSTEM
#1
Photo 
(This post was last modified: 02-03-2024, 05:27 PM by kenjis.)

[img=856x456]/home/shenko/Pictures/Screenshots/a.png[/img]#---Just List out the files in public/archive CodeIgniter 4.4.4---#

here is my Controller:

PHP Code:
<?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);
    }


# See the /Views/library.php in the next reply
Reply


Messages In This Thread
Cannot figure out helper FILESYSTEM - by shenko225 - 02-03-2024, 12:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB