Download file after filling a form [closed]
문제
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?
해결책
Instead of creating different webforms for each file, you could just have one form that can handle this. Here is my suggestion:
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.
Create a custom submission handler for your webform to trigger a download upon submission (use the filename from the hidden field on the form).
다른 팁
To stream (and protect) the file, you should try using https://www.drupal.org/project/webform_confirmation_file