Task: send a file attached to the mail message via the contact form
Screen_form
In the screenshot you can see that there is a field for attaching files. But I can not add the file there. There is no selection button, and if you try to drag and drop the file into this area, it is not attached.
The letter is sent without this file and the page is not shown: thank you.
I can not understand why the file is not attached
plugins/form/form.yaml
enabled: true
built_in_css: true
files:
multiple: false # To allow multiple files, default is single
limit: 10 # Number of allowed files per field (multiple required)
filesize: 5 # Maximum file size allowed (in MB)
destination: ‘self@’ # Where to upload the files (path and self@, page@, theme@)
avoid_overwriting: false # Prevent files with the same name to be overridden. Date prefix will be added
random_name: false # Generate a random 15 long string name for the uploaded files
accept: # List of mime/types or file extens ions allowed (ie, image/,.zip,.mp4)
- image/
title: Связь
form:
method: GET
name: my-nice-form
fields:
- name: name
label: Имя
placeholder: ваше имя
autofocus: on
autocomplete: on
type: text
validate:
required: true
- name: email
label: Е-майл
placeholder: ваш е-майл
type: text
validate:
rule: email
required: true
- name: message
label: Сообщение
size: long
placeholder: сообщение
type: textarea
validate:
required: true
- name: my-file
label: 'Добавить файл'
type: file
buttons:
- type: submit
value: Submit
classes: btn
- type: reset
value: Reset
classes: btn
process:
- email:
from: "{{ config.plugins.email.from }}"
to:
- "{{ config.plugins.email.from }}"
- "{{ form.value.email }}"
subject: "[Feedback] {{ form.value.name|e }}"
body: "{% include 'forms/data.html.twig' %}"
attachments: [my-file]
- save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
body: "{% include 'forms/data.txt.twig' %}"
- message: Thank you for your feedback!
- display: thankyou
---