2

I have a standard user profile form. But now I would like that the user can upload images in new subfolder and make own subfolder. Is there any solution or a plugin for this?

1

No idea if it lets users create subfolders on the front-end, but this is the closest plugin I could find: https://straightupcraft.com/craft-plugins/assets-browser

If that doesn't do it, most likely you'd need to do some custom plugin work to do what you're looking for.

| improve this answer | |
  • If I wanted to do this in my own plugin, would it essentially just be listening for the users.onActivateUser event when a new user registers/activates their account, then using PHP's mkdir() function to create a subfolder for that particular user in my assets folder? Then it seems like the rest is simply setting the file upload field in the profile form to target that user's subfolder, presumably by id, as the destination. Is this the right track? – Ryan Nov 24 '17 at 3:05
  • @Ryan you need to know there are two kinds of folders in craft. First: your local file system folder you create with mkdir() second: your craft FolderModel you require in order to manage assets in your cp. The insertFileByLocalPath function to include assets to the system requires such a folder model ID. So if you don't want to throw every asset into the same craft folder you would need to create one of those as well. I would suggest you create a new question then I'll show my code to create subfolders, insert files in it and link those to an entry. – Robin Schambach Nov 27 '17 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.