How to create a new subfolder to an asset with plugin I have a plugin that uploads and associates files/assets to users and entries. I would like it to store these files under a user ID subfolder of the asset folder. I know how to do this within the controlpanel, working with assets there. But how would I create and register subfolders within my plugin? If I just create the folder with my php script, it doesnt show up in the assets folder until i do a "Update Asset Indexes".

The way my plugin works now, It creates an asset with the craft()->assets->insertFileByLocalPath, and then associates the fileId with my entry after its created/uploaded. Maybe this is not the right way to do it?

Any help much appreciated.
I’ve had the problem with storeFolder() that it doesn’t create a folder that is accessible via the control panel or the file system.

I find createFolder() much easier to use and it did what I expected:

$response = craft()-&gt;assets-&gt;createFolder($parentFolderId, $folderName);
$folderId = $response-&gt;getResponseData()['folderId'];