SkysTheLimit_81
SkysTheLimit_81

Reputation: 21

CakePHP Controller creates an empty Folder

I would be happy to create a folder automatically as soon as I get a new record on the "add" investing. In addition, I would still prefer it if this is the folder would also get the ID of the record. Is this possible?

Currently I have the following. But he puts me not even a folder.

$dir = new Folder(WWW_ROOT . 'files' . DS . 'images');

Did you maybe have a solution?

Upvotes: 0

Views: 1317

Answers (1)

Mark
Mark

Reputation: 3271

The Folder constructor does not automatically create a folder on the disk, you'll have to provide a second parameter as true, see the api

In your case this would be

$dir = new Folder(WWW_ROOT . 'files' . DS . 'images', true);

You can add a third parameter to provide the new directory with permissions

Upvotes: 1

Related Questions