1

It appears that Drupal 7 lacks a good, user-friendly bulk node creation/file uploading module, and I'm wondering why.

Specifically, I'm wondering what unforeseen issues I'd run into if I tried to create my own. What hook would I use? What do I need to know about saving files and creating nodes out of them before embarking on this task? What terrifying monsters must exist in this terrain that it's never been tread?

My specific plan so far is to use the Form API and hook_form_alter to create a webform with a field that can do multi-uploads of images and then, upon submission, generate nodes with Title = image name and an image field that will get populated with the location of the image file.

Has anyone out there attempted anything similar with Drupal 7, and if so, what were your results / what warnings would you give?

2 Answers 2

2

I don't think there is any particular difficulties in bulk creation of a nodes from a set of uploaded files. What would be difficult and probably explain why there is not such feature implemented in Drupal 7 is that it would be difficult to make it generic and re-usable. Mapping files to node is not a straightforward process. Variability is probably to high to allow a meaningful re-usable implementation.

If you plan to do write custom code, don't start with Webform. Webform is great for forms that are content to be edited by end users of the site/CMS. They are not designed to be a developer tool to create complex forms with custom backend behaviors. Using Webform will force you to deal with two form APIs in code. While one of them is designed to serve UI users, not developer.

You, or your user, would probably love to have a single widget to upload multiples files (as opposed to multiple file form element). But I suggest you first get a working solution that rely on the Form API and the available file widget. Drupal's API are build to work with standard and old-style browser to server interactions. Introducing new interactions model early into the mix will likely make thing unnecessary difficult by forcing you to learn and understand Drupal's API and inner working only to find workaround for its limitations. Once you get a working solution, search solutions to build a better UI/UX using progressive browser side enhancement. OR at least, refactoring a working solution build on sane and understood bases.

Since processing multiple files and creating multiple nodes is likely a long running operation, you should use the Batch operations API.

1

One possible reason is that front-facing bulk node creation isn't commonly required functionality, at least in my experience. This ability is usually confined to privileged users who can use the Feeds module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.