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) ...
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, ...
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 ...
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 "...
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:
{{ ...
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 ...
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 ...
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'...
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 ...
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. ...
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,
'...
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 ...
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 ...
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 ...
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 ...
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-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
subfolder × 17assets × 13
upload × 3
plugin-development × 2
plugin-craftcommerce × 1
matrix × 1
plugins × 1
control-panel × 1
entry × 1
error-message × 1
tags × 1
query × 1
mysql × 1
installation × 1
permissions × 1
graphql × 1
mamp × 1
assets-field × 1
assetfilemodel × 1
files × 1
windows × 1
volumes × 1
alias × 1