I'm using Drupal 8 with Webform module.
I want to allow users to upload one or several files when filling the form. Is it possible with Drupal 8? May be some additional module required for this?
I'm using Drupal 8 with Webform module.
I want to allow users to upload one or several files when filling the form. Is it possible with Drupal 8? May be some additional module required for this?
You need to enable webform UI, then set in your sites/default/settings.php file the privates files directory path:
$settings['file_private_path'] = 'sites/default/files/private';
where 'sites/default/files/private' is your privates files directory path. You can choose another directory. And give to this directory the write permission. Then clear all caches. Now you can add files fied in your webform while adding new element. In the popup that appears, typing file, you will see all files type like image, audio, etc.
'../files'
or '../private'
Yes, you can allow users to upload files to the webform by adding a new "managed_file" form element into the "Elements (YAML)":
This is provided that you have your public and private file paths set, which will otherwise throw a notice telling you to set those up.
Another solution of yaml configuration for images in order to upload a file:
picture:
'#type': image_file
'#title': Photo
'#file_extensions': 'gif jpg png svg jpeg'
'#multiple': True
You can install the module Webform UI to do this in the interface...