MSRP - How to CRUD image/file attachments?
Hi all,
Does there exist an example usage of storing/reading an attachment through the SRP API?
With the how-to samples on Github, specifically the TodoMVC sample[1], I've been able to figure out how to CRUD UGC in MongoDB through the SRP API in our custom components. However, I'm really not sure how to, or what the best practices are for, upload image attachments from custom UGC components.
Right now I'm using the same method I wrote for storing the post but one level down, with a random md5 hash of the current timestamp + filename, and storing the image data as a byte array. This just throws it into the same collection as the rest of the UGC though, and just looking at the Storage Configuration options, there's clearly a separate collection just for attachments.
Thanks for any and all help!
[1] https://github.com/Adobe-Marketing-Cloud/aem-communities-todomvc-sample