Question

On my site, the visitors can download whitepapers as pdf. I would like to gather some information before handing over the file. Updates: the downloads should be open to unregistered users

What I tried: I looked around for modules. Some of them seemed to do something like this but were Drupal 7 only, like Webform Protected Downloads. On the site I can make use of the Webform module as per this question. I could make a form with a redirect page where the file can be downloaded. However, as there are many whitepapers, for each one there should be made a separate form and download page. Update: in Webform it is possible to stay on the same page and output a thank you message with download link, so that will limit the effort somewhat.

Is there a simpler way to solve this?

Was it helpful?

Solution

Instead of creating different webforms for each file, you could just have one form that can handle this. Here is my suggestion:

  1. Make all links to your whitepapers to load a webform and pass the filename as a parameter for your webform. You can then store that on a hidden field on the form.

  2. Create a custom submission handler for your webform to trigger a download upon submission (use the filename from the hidden field on the form).

OTHER TIPS

To stream (and protect) the file, you should try using https://www.drupal.org/project/webform_confirmation_file

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top