1

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.

enter image description here

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?

enter image description here

kobaltz
  • 6,980
  • 1
  • 35
  • 52

1 Answers1

1

I don't think this is possible. See here: http://www.codeproject.com/Questions/573788/HoeplustoplusGetplustheplusOriginalplusfilepluspat

It appears that you can't know the context of the uploaded file on the source operating system. Therefore you can't create it's original parent folder structure on your system.

Brendon Muir
  • 4,540
  • 2
  • 33
  • 55
  • How is Dropbox's web interface able to detect it then? I didn't authenticate Dropbox for monitoring of the original file name (commonly found with Java Web Based Applications and/or Flash applets). Also, I do not have the Dropbox service installed on my computer. – kobaltz Jun 16 '13 at 03:34
  • Actually, it does look like Dropbox is using SWFUpload which is a flash based uploader which means that it can scan your computer's original folder. – kobaltz Jun 16 '13 at 03:36