Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module securely shares files by linking access to webform submissions. Users must fill out a webform to get a token-based download link for a file. This is ideal for distributing sensitive documents like reports or gated content while also collecting user information.

Introduction

The File Access Via Webform module allows Drupal site administrators to securely share files through webforms. It uses token-based access to ensure only authorized users can download sensitive files, making it ideal for beginners managing file access. This module provides a simple, user-friendly solution for protecting documents while collecting user information via webforms.

Features

What is the basic functionality?

This module enables secure file downloads through Drupal webforms. Users must submit a webform to access a file, and the module uses tokens to verify access, preventing unauthorized downloads.

What unique features does enabling this project add?

  • Token-based security: Protects files with unique, temporary access tokens.
  • Customizable download behavior: Choose whether files open in the browser or download automatically.
  • Webform integration: Links file access to webforms for user data collection.
  • Custom messages: Display tailored messages after downloads.
  • Modal dialogs: Optional Bootstrap 4 Modal for a polished user experience.
  • Field formatter: Adds a “Webform Download Button” for file fields.
  • Media support: Works with direct file fields and media document references.

When and why would someone use this module?

Use this module to securely distribute files like PDFs, reports, or proprietary documents while collecting user information. It’s ideal for sites needing user verification before granting file access, such as gated content or client resources.

What use cases are there?

  • A company sharing whitepapers after users submit contact details.
  • A university providing lecture notes to registered students.
  • A nonprofit distributing secure reports to donors via a webform.

Post-Installation

Once installed, the module adds a “Webform Download Button” formatter for file fields and a “File Access Download Redirect” handler for webforms. Users click a button to access a webform, submit it, and receive a secure download link.

Configuration process

  1. Set up the field formatter:
    • Go to /admin/structure/types (Structure > Content types).
    • Select your content type, then click “Manage display.”
    • For your file field, choose the “Webform Download Button” formatter.
    • Configure settings:
      • Modal width: Set dialog size (e.g., “800px”).
      • Link text: Customize button text (e.g., “Download Now”).
      • Show header/title: Toggle modal header visibility.
      • Webform: Select the webform for access control.
  2. Configure the webform handler:
    • Go to /admin/structure/webform (Structure > Webforms).
    • Select or create a webform, then go to “Settings” > “Handlers.”
    • Add the “File Access Download Redirect” handler.
    • Configure settings:
      • File disposition: Choose “inline” (view in browser) or “attachment” (force download).
      • Download message: Set a custom message (e.g., “Your file is downloading…”).
      • File URL security: Select “enhanced” for token-based URLs or “standard” for direct URLs.
      • Debug mode: Enable for troubleshooting (disable in production).
  3. Test the setup:
    • Create a node with a file field and the configured formatter.
    • Visit the node, click the download button, submit the webform, and verify the file downloads.

Special considerations

  • Ensure the webform is accessible to intended users (check permissions at /admin/people/permissions).
  • If using modals, test responsiveness for mobile users.
  • Review logs at /admin/reports/dblog for errors (e.g., invalid webform settings).

Recommended Modules/Libraries

  • Bootstrap 4 Modal: Enhances the module with modal dialogs for a better user experience (composer require drupal/bootstrap4_modal).
  • Supporting this Module

    Support development through:

    Community Documentation

Activity

Total releases
5
First release
May 2025
Latest release
2 months ago
Releases (12 mo)
1 ▼ from 4
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.3 Stable Apr 25, 2026
1.0.2 Stable May 11, 2025
1.0.1 Stable May 10, 2025
1.0.x-dev Dev May 10, 2025
1.0.0 Stable May 10, 2025