Media Bulk Upload

Allows uploading multiple files in bulk and automatically creates corresponding media entities using DropzoneJS drag-and-drop interface.

media_bulk_upload
14,884 sites
57
drupal.org

Install

Drupal 11, 10, 9, 8 v3.0.4
composer require 'drupal/media_bulk_upload:^3.0'

Overview

Media Bulk Upload is a Drupal module that streamlines the process of uploading and managing multiple media files. It leverages the DropzoneJS library to provide a user-friendly drag-and-drop interface for uploading files in bulk, automatically creating media entities for each uploaded file.

The module introduces a configuration entity system that allows administrators to create multiple bulk upload forms with different configurations. Each configuration can specify which media types are allowed, enabling the system to automatically assign the correct media type to uploaded files based on their file extensions. When file extensions overlap between media types, the module automatically assigns the file to one of the matching types.

A powerful feature is the shared fields functionality, which displays fields that are common across all selected media types in the upload form. This allows users to pre-fill metadata (such as alt text, title, or custom fields) that will be applied to all uploaded media entities, significantly speeding up the content creation workflow. The module also supports form modes, allowing administrators to control which fields appear in the bulk upload form.

Features

  • Drag-and-drop file upload interface using DropzoneJS library for quick and intuitive bulk file uploads
  • Configuration entity system allowing multiple bulk upload form configurations with different media type combinations
  • Automatic media type detection and assignment based on file extension mapping
  • Shared field support - displays fields common to all selected media types for bulk metadata entry
  • Form mode selection for customizing which fields appear in the upload form
  • File size validation per media type configuration, respecting individual media type upload limits
  • Batch processing for handling large numbers of file uploads efficiently
  • Dynamic permission generation for each bulk upload configuration, enabling fine-grained access control
  • Integration with Admin Toolbar Extra Tools module for convenient menu placement
  • Support for multiple media types in a single upload form with extension-based routing

Use Cases

Bulk uploading images for a photo gallery

Create a Media Bulk Config selecting only the 'Image' media type. Users can then drag-and-drop multiple images at once, and optionally fill in shared alt text or other metadata fields that will be applied to all uploaded images.

Mixed media upload for content editors

Create a Media Bulk Config that includes Image, Document, and Video media types. The system will automatically detect the file type based on extension and create the appropriate media entity. For example, .jpg files become Image media, .pdf files become Document media, and .mp4 files become Video media.

Streamlined asset ingestion with metadata

Configure a form mode that includes taxonomy term references or custom fields. When bulk uploading, content editors can select a category or enter metadata once, and it will be applied to all uploaded media items, saving significant time compared to editing each item individually.

Departmental upload forms with access control

Create separate Media Bulk Config entities for different departments (e.g., 'Marketing Assets', 'HR Documents'). Grant the corresponding 'use X bulk upload form' permission to appropriate roles. Each department can only access their designated upload form.

High-volume media migration

When migrating content that includes many media files, use the bulk upload feature to quickly import files. The batch processing ensures that large numbers of files are handled efficiently without timeout issues.

Tips

  • Create separate bulk upload configurations for different use cases (e.g., one for images only, one for documents) to provide cleaner user experiences
  • Use form modes to control which fields appear in the bulk upload form - create a 'bulk_upload' form mode with only essential fields to streamline the upload process
  • The bulk upload link automatically appears in the Media Library and Content > Media admin pages, providing quick access for content editors
  • Maximum file size respects the highest limit among selected media types, so including a media type with a large file size limit will increase the allowed size for all uploads in that form
  • All shared fields are made optional during bulk upload, so required field validation happens when editing individual media items later

Technical Details

Admin Pages 6
Media Bulk Upload Configuration /admin/config/media/media-bulk-config

Lists all configured Media Bulk Config entities. From here administrators can add, edit, or delete bulk upload form configurations. Each configuration defines which media types are available for bulk upload and which form mode is used.

Add media bulk upload configuration /admin/config/media/media-bulk-config/add

Form to create a new Media Bulk Config entity. Allows administrators to define a new bulk upload form by selecting media types and optionally a form mode for shared fields.

Edit media bulk upload configuration /admin/config/media/media-bulk-config/{media_bulk_config}/edit

Form to modify an existing Media Bulk Config entity. Allows changing the label, media types, and form mode settings.

Delete media bulk upload configuration /admin/config/media/media-bulk-config/{media_bulk_config}/delete

Confirmation form to delete a Media Bulk Config entity. This will remove the bulk upload form configuration but will not affect any media entities that were created using it.

Bulk upload media /media/bulk-upload

Landing page for bulk media upload. If only one Media Bulk Config exists, users are automatically redirected to that upload form. If multiple configurations exist, a list of available bulk upload forms is displayed based on user permissions.

Multiple upload /media/bulk-upload/{media_bulk_config}

The actual bulk upload form where users can drag-and-drop or select multiple files for upload. Displays information about allowed media types, file extensions, and maximum file sizes. If a form mode is configured, shared fields are displayed for bulk metadata entry.

Permissions 2
Configure Media Upload form

Allows users to create, edit, and delete Media Bulk Config entities at /admin/config/media/media-bulk-config

{Config Label} : Use upload form

Dynamic permission generated for each Media Bulk Config entity. Grants access to use the specific bulk upload form. Users need this permission to access /media/bulk-upload/{config_id}.

Hooks 2
hook_help

Implements hook_help() to provide module help text on the help page

hook_menu_links_discovered_alter

Alters menu links to integrate with Admin Toolbar Extra Tools module. When Admin Toolbar Extra Tools is enabled, places the bulk upload menu item under Content > Media.

Troubleshooting 6
DropzoneJS is not working or showing errors

Ensure the DropzoneJS module is properly installed and the DropzoneJS JavaScript library is placed in the correct location. Follow the DropzoneJS module's installation instructions carefully.

Files are uploaded but no media entities are created

Check that the file extension is included in one of the selected media types' allowed extensions. Also verify that the target field on the media type has the correct file extension settings.

Permission denied when accessing bulk upload form

Users need the specific 'use [config_id] bulk upload form' permission for each configuration. Grant this permission at /admin/people/permissions.

Shared fields are not appearing in the upload form

Ensure a form mode is selected in the Media Bulk Config. Also verify that the fields you expect are configured to display in that form mode for all selected media types. Only fields that exist in all selected media types will be shown.

File size limit is too restrictive

The maximum file size is determined by the largest max_filesize setting among the selected media types. Check and adjust the field settings on individual media types. Also verify PHP's upload_max_filesize and post_max_size settings.

Files are being assigned to the wrong media type

When file extensions overlap between media types (e.g., both Image and Document accept .png), the assignment is automatic. Consider using non-overlapping extensions or creating separate bulk upload forms for each media type if precise control is needed.

Security Notes 4
  • Access to bulk upload forms is controlled by granular permissions - each configuration has its own permission
  • Users still need appropriate media creation permissions in addition to bulk upload permissions
  • File validation occurs based on the configured media type settings including allowed extensions and file size limits
  • The module uses Drupal's file handling system which provides security against malicious file uploads