Drupal Tutorials and Blog Posts

Multiple image uploads in Drupal with Plupload

One of our students was setting up a photo gallery and asked:

"I was wondering what module you think would best enable my site members to upload multiple photographs at once."

There are several ways to do this with Drupal. We're going to show you one option that uses a script called Plupload.

Multiple image uploads by default

It is possible to allow a basic multiple image upload feature in Drupal without adding any modules.

When you create a default image field, simply set the "Number of values" to more than 1.

However, it will still be fairly difficult to use. When you come to add the images, the process will be this:

  • Choose an image
  • Click Upload
  • Wait for a new file upload area to appear
  • Choose an image
  • Click Upload
  • Wait for a new file upload area to appear
  • Repeat until done ...
media_1357849852382.png

Let's see if we can make that workflow easier for our users by using Plupload.

Install the modules and files

Install and enable these two modules:

We'll now to need to upload the files for Plupload.

media_1357849448426.png
  • Extract the files that you just downloaded. You'll get a folder called /plupload/
  • Browse to the /sites/all/ folder in your Drupal site
  • If you don't have a /libraries/ folder here, create one
  • Upload the /plupload/ folder into your /libraries/ folder
media_1357849610622.png

Create a new field

  • Go to Structure > Content types > Manage fields
  • Choose Image and then choose Plupload as the widget
  • All of the settings will be identical to a normal image field
media_1357848873640.png
  • Finish creating the field
  • Go to Content > Add content and create a new content item
  • You'll see a multiple file upload area as in the image below
  • To upload images, you can either drag files into the marked space or you can click Add
media_1357848962030.png
  • Add all the images you want to upload
  • Click Upload
media_1357849060752.png
  • You'll see a small progress bar:
media_1357849081119.png
  • You'll see thumbnails of the images:
media_1357849106642.png

Comments

 
RdeBoer
#1 RdeBoer 2013-01-10 21:36

Thanks for sharing these great instructions.
Can this be used together with elFinder?
 
 
steve
#2 steve 2013-01-10 21:45

I don't believe it does, I'm afraid. There's a list of more plupload integrations here: drupal.org/project/plupload

It's been a while since I've tested, but Elfinder does claim multiple file upload: drupal.org/project/elfinder
 
 
thedavidmeister
#3 thedavidmeister 2013-01-11 03:09

drupal.org/project/plupload and drupal.org/project/plup are two different things. I prefer the former, and it integrates well with drupal.org/project/imageeditor which is cool for "the complete package".
 
 
Wirka
#4 Wirka 2013-02-25 00:47

I did all instructions but at the last once "You'll see thumbnails of the images:", I can't see my thumbnails image, the crash image is appear. When I check it on resource, there a forbidden issue to the thumbnails image. What should I do?
 
 
Balu
#5 Balu 2013-03-04 07:14

Since the last Update (7.20) Drupal adds a key to the query string of images in order to avoid ddos attacks. Plup seems to habe problems with that. A short search didn't bring up any redults. Any ideas?
 
 
Balu
#6 Balu 2013-03-04 09:54

@Wirka:

add: $conf['image_al low_insecure_de rivatives'] = TRUE;

to your settings.php.
 
 
Jamie
#7 Jamie 2013-03-05 01:38

Having the same problem after 7.2 update. Thumbnails are broken on initial upload but appear if the node is edited. Do not want to add that line to setting.php as it bypasses security fix. Any other ideas?
 
 
steve
#8 steve 2013-03-07 21:20

Hi Jamie, Balu, Wirka

Drupal 7.21 has been released to fix this bug.
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,142 training sessions in Joomla, Drupal, WordPress and Coding.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.

Copyright 2013 Open Source Training, LLC. All rights reserved.