Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Form file upload does not work

Started by Piotr Jóźwiak 9 years ago · 2 replies · 1009 views
9 years ago

Hi guys!
I heve problem with attaching files to email message.
I have configured this fields:

YAML
form:
action: /contact
name: contact-form
fields:

......

-
name: my-file
label: 'Add a file'
type: file
multiple: false
destination: user/data/files
accept:

  • application/pdf
  • application/x-pdf
  • image/png
  • text/plain
    buttons:

    YAML
        type: submit
        value: 'Send Message'
        classes: 'btn btn-primary'
    

    process:

    TWIG
        email:
            from: '{{ config.plugins.email.from }}'
            to: ['{{ config.plugins.email.to }}']
            subject: '[Contact] {{ form.value.name|e }}'
            body: '{% include ''forms/data.html.twig'' %}'
            content_type: 'text/html'
            charset: 'UTF-8'
            attachments:
            - my-file   
    

But still i receive messages without attachment.
Also ajax upload does not work and it looks like inactive button. I have to uncheck "display: none" in css properties.
Anybody have idea what is a problem?

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago