Mass file upload through ZIP, extracting on the server and translating folder structure to taxonomy?
Hi,
I am new to module development, have been making some tweaks to existing modules so I get the basic idea.
What I currently need most for a site that is largely used for document management is the capability for users to upload large amounts of files simultaneously. The approach I was thinking of would be to have a node type called "bulk upload" that takes attachments in the form of a .zip archive.
Once the zip file is uploaded and the node created, the module should extract the zip file and transform its content into Drupal nodes. If the archive has a flat hierarchy, the files should be added as single attachments to the node. If the archive has a folder structure, the module should ideally recreate the folder structure as taxonomy terms - their parent term being the parent term of the "bulk upload" node created. For this to work, it would either need to be required to select a taxonomy term for that node, or the module would need to create a new vocabulary to accomodate the file folder structure. In this scenario, the single "child" nodes that result from the bulk upload will be prefilled with all settings entered for the bulk upload node (i.e. i80n, publishing options etc.) and can obviously be edited manually later.
Three and a half questions:
1) Does this make any sense?
2) Is it feasible to develop a module like this? Is it feasible for a relative beginner?
3) Is there perhaps anything similar out there that I have just missed?
Thanks and I hope to get a discussion started here because multiple file uploads are a real pain at this point...
Patrick

This is doable, but would be
This is doable, but would be difficult for a relative beginner to pull off.
Basically the steps are:
1. Create a module that builds a new node type. Copying one of the existing modules that does this and dissecting it should help here.
2. Build the node form, starting with the basic node form, and adding a file upload element. Change the form encoding for file uploads.
3. In your hook_validate, confirm that the user has uploaded a .zip archive, and set an error if they have not.
4. In your hook_submit, confirm again that the file is actually a real .zip archive (and not an archive that the user is trying to trick you with), then unzip it and store its location.
5. Also in your hook_submit, call a recursive function to traverse the folder structure and create a new node type with the term equal to the name of the folder/file. This is the tricky bit.
Good luck!
My site: http://www.unitorganizer.com/myblog
Thanks for the structure!
Thanks for the structure! I'll see to it that I get started sometime on this... Seems like something other people might find useful, too.
Solution / new Module?
Hi Patrick,
Did you solve your challenge?
I am just starting with drupal and I am also looking for such a functionality for creating new photo galleries.
I think setting some default values (subtitle, photographer/copyright) for all pictures would be also interesting.
So can you give us some ideas, a howto or even a ready to use module?
I would appreciate it! ;-)
Best regards,
Christian
--
Christian
Did this materialise into a project?
- anyone working on this or knowing of similar efforts?
Examine the image module and
Examine the image module and see how it works.
It has a sub module for uploading images in bulk.
You could get some ideas of how to create such a module.
By the way I am looking for such a module. Does one exist?
===============================
Quintessentially | Supremely | American
Krishna is the God star