Silverstripe Version: 3.6.5
SilverStripe form upload field needs to map uploads to a data object.
_I’ve been struggling with this for several days now. I have a SilverStripe form that is meant to update Project data objects through the front-end of the site. The form has a few bulk upload fields (I’m using this module here: GitHub - unclecheese/silverstripe-dropzone). I have things setup so that, when images and files are uploaded, they go to the proper folder in assets (in this case, it’s assets/projects/[projectid]/[folder name]). However, the uploads are not associated with a Project–any Project. In order to display the currently uploaded files on the front end and to show the files as attached to a Project in the admin, I want to be able to associate uploads to a Project (via ID of the Project or some other relation).
I’ve tried various things, including solutions found in the StackOverflow post: php - SilverStripe 3.6.5 - Associate uploaded files from a front-end SilverStripe form to data object - Stack Overflow
But so far, no luck. I either get errors or the files upload to the correct asset folder but fail to be associated with a Project.
View the StackOverflow post in the link for all the relevant code (it’s more than should be pasted here).
If anyone has any suggestions (solutions, a better method–anything), I’d be grateful because this has been giving me trouble for days now. Thanks in advance!
_