I am trying to get a drop down list of all the folders under assets. I think I need to do something with enum(?) but I am not sure where to go with it. Could anyone give me a pointer? Thank you :)
$fields->addFieldToTab("Root.Content.Main", new DropdownField('Folders','Choose a folder', DataObject::get("Folder")->toDropdownMap()));
Let me explain a little bit more. I am making a custom widget for one of my sites. With the widget permitted members will be able to upload files directly to the the chosen folder (The folder will be chosen by the admin, when the widget is added to the page.). I need to be able to get a drop down list as a select/option in the admin section for the admin to choose which folder the uploads will be to.
Thank you for the above code, but I'm not sure if that's what I am looking for or not. Where would that go?
That helped me heaps, thanks so much UC.
How would you do this for picking an image within the folders. Like the image picker works in the WYSIWYG within the content field?