Welcome Guest, Not a member yet? Register   Sign In
FileCollection and addDirectory
#1

Hello,
I was trying to use the FileCollection class that is documented at https://codeigniter.com/user_guide/libra...ollections but I can't get it to work and I don't know if the problem is me or the documentation Big Grin
I just did something stupid like this in a class that extends a BaseCommand.

PHP Code:
$Scripts = new \CodeIgniter\HTTP\Files\FileCollection([]);
 
$Scripts->addDirectory(APPPATH.'Database/sqlUpdates');
$Scripts->retainPattern('*.sql');
CLI::write(count($Scripts)." found in the App/Database/sqlUpdates folder"); 


Nothing too fancy. and pretty similar to the example given.
Running this I get:

Code:
Call to undefined method CodeIgniter\HTTP\Files\FileCollection::addDirectory()

which frankly seems reasonable since I have nothing called "addDirectory" (neither retainPattern) in my entire source tree.

I feel like I'm missing something obvious, can someone give me an hint?

Thanks.
Reply
#2

(This post was last modified: 01-23-2022, 01:14 PM by iRedds.)

\CodeIgniter\HTTP\Files\FileCollection
and
\CodeIgniter\Files\FileCollection

These are different classes. You need a second one.
Reply
#3

That gives me Class "CodeIgniter\Files\FileCollection" not found....

This is a grep for "FileCollection" in my project's home:


Code:
system/HTTP/IncomingRequest.php:use CodeIgniter\HTTP\Files\FileCollection;
system/HTTP/IncomingRequest.php:    * @var FileCollection|null
system/HTTP/IncomingRequest.php:            $this->files = new FileCollection();
system/HTTP/IncomingRequest.php:            $this->files = new FileCollection();
system/HTTP/IncomingRequest.php:            $this->files = new FileCollection();
system/HTTP/Files/FileCollection.php: * Class FileCollection
system/HTTP/Files/FileCollection.php:class FileCollection


I don't see any system/Files/FileCollection.php..... ?
Reply
#4

Ok, I think I understood:
https://github.com/codeigniter4/CodeIgni...ection.php
This is rather new stuff I suppose...
I'll update CI and try again.
Reply
#5

(This post was last modified: 01-23-2022, 10:58 PM by luckmoshy.)

Hi Guys I have mult-input form data and i want to do like:

PHP Code:
$email = \Config\Services::email();

$email->setFrom('[email protected]''Your Name');
$email->setTo('[email protected]');
$email->setCC('[email protected]');
$email->setBCC('[email protected]');

$email->setSubject('Email Test');
$email->setMessage('

          $this->request->getVar('
one'); ==/*<input name="one">*/
          $this->request->getVar('
two');/*<input name="two">*/
          $this->request->getVar('
three');/*<input name="three">  and so on.....*/


'
);

$email->send(); 

How do I organize this in Html or text mail?
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply




Theme © iAndrew 2016 - Forum software by © MyBB