Search code examples
pyrocms

not able to load files library in custom module in pyrocms


i have an action

public function filesTest()
    {
        $this->load->library('files/files');
        $folder = $this->file_folder_m->get_by('slug', 'package_module');
        $file_data = Files::upload($folder->id);
        print_r($file_data);die();
        other codes.....
    }

this action prints following Fatal error: Call to a member function get_by() on a non-object


Solution

  • i got above solution from https://forum.pyrocms.com/discussion/16977/files-module-folder-id

    the only thing that needs to be corrected was

    $folder = $this->file_folders_m->get_by('slug', 'package_module');
    

    Solved.. :)