I have a fairly simple file upload system. Whenever multiple files are uploaded, it creates a new record in the database and stores the file name under the field file_leaf
. Within the application, you can create subfolders and they are indicated by the boolean branch
.
Parent_id is used to determine if a file belongs to a folder. In this example, Sub Folder is a folder who belongs to Test Main Folder. baby_3.jpg is a file that belongs to the folder Test Main Folder.
I have situations where I will drag and drop the files from a folder. This folder may have subfolders and files within the subfolder. How could I get carrierwave to understand that the source of this image was in a sub folder, create the record for the subfolder and then attach the parent_id to the file of the id of the subfolder?