3 votes
Accepted

Create folder in asset volume via GraphQL

Currently, there’s no direct way of doing this. You can pass an existing folder ID but you can’t create folders on the fly. However, you can create folders via an asset field (with dynamic path) ...
Oli's user avatar
  • 7,410
3 votes
Accepted

Dynamic Subfolders leaving empty folders behind

When Assets moves files around because of dynamic Assets folder changes, it does not remove empty folders. On the surface it seems like a no-brainer - just check if the folder is empty and if so, ...
Andris Sevcenko's user avatar
3 votes
Accepted

How to create a new subfolder to an asset with plugin

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 ...
medoingthings's user avatar
2 votes

{% block content %} is a no-go in template/subfolders

In this case, it was just human error and ignorance of how hidden template files work through the CMS. I believed that I should be able to call the hidden file in the browser, via something like "...
Thomas's user avatar
  • 31
2 votes

Dynamic asset subfolder path for Craft Commerce

If you have an Asset field outside of Matrix and you want to set its "Upload Location" to be a dynamic value of Dropdown field inside of a separate Matrix field, something like this should work: {{ ...
Brad Bell's user avatar
  • 67.2k
2 votes
Accepted

How query all folders of a volume?

You can use craft\services\Assets::getAllDescendantFolders to get a list of folders in a given folder. To list all folders in the root folder of the volume, you first need to find the root folder ...
MoritzLost's user avatar
  • 10.7k
1 vote
Accepted

Craft site in subfolder of domain

I found the solution after a lot of poking and prodding: 'aliases' => [ '@assetBaseUrl' => '/distribution/assets/', '@assetBasePath' => '/path/to/the/assets/', ], Added into the ...
steve's user avatar
  • 131
1 vote

Dynamic Asset Sub Folder Paths based on section and. if/else or turnery operators

So this was a simple fix and not to use {% %} tags but instead to use {{ }} tags. Changing the above logic in the subdirectories filed like so seems to have resolved the issue. {{ section == 'Company'...
Terry Upton's user avatar
  • 1,884
1 vote
Accepted

Dynamic asset subfolder path for Craft Commerce

I gave up my project to dynamically upload assets through matrix field dropdown values where the asset field is outside of the matrix field. I actually just wanted to save assets in a logical ...
TomS's user avatar
  • 213
1 vote

Can't save entries with dynamic subfolder path in Matrix

I figured it out -- I'll leave the question up in case anyone else runs into the issue. I had Assets fields in my Matrix, but I also had a SuperTable field in the Matrix which contained an image. ...
artmem's user avatar
  • 1,012
1 vote

How to create a new subfolder to an asset with plugin

To answer my own question, I found the answer in the source code. $newFolder = new AssetFolderModel( array( 'parentId' => $currentFolderid, '...
ladrua's user avatar
  • 283
1 vote

{% block content %} is a no-go in template/subfolders

It's not a server sided issue you are running into. Best guess is that you deleted some of the original code in either the _layout.html or your new template file. When you first setup the environment ...
Justin Dekkers's user avatar
1 vote

List subfolders of a specific asset folder

Not a complete answer, but in your example image if going to be an instance of AssetFileModel. AssetFileModel has a getFolder method that returns an instance of AssetFolderModel. AssetFolderModel ...
Brad Bell's user avatar
  • 67.2k
1 vote
Accepted

In an Asset field, how to use a dynamic subfolder field value that is dependent on the element type?

It seems that the ?? operator or the is defined operator do not work at that level, for a reason unkown to me. I found a workaround: testing against a property which I know will always be there. In ...
kant312's user avatar
  • 496
1 vote

Tagging all assets in a sub directory

Seems doable with a custom plugin. The pseudo-code would be something like: Use AssetsService to grab all of the files for the source. Loop through the files and parse the parent folder paths. Based ...
Brad Bell's user avatar
  • 67.2k
1 vote
Accepted

Uploading to a date subfolder within a Matrix

You're probably looking for: {owner.postDate|date("d-m-Y")} See the note about dynamic subfolders on an Assets field inside of Matrix here: https://craftcms.com/docs/assets-fields#dynamic-subfolder-...
Brad Bell's user avatar
  • 67.2k

Only top scored, non community-wiki answers of a minimum length are eligible