Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Form file upload does not work

Started by Piotr Jóźwiak 9 years ago · 2 replies · 1310 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 Japhy, 2 weeks ago
2 272 4 days ago
Forms & Blueprints · by FrViPofm, 4 weeks ago
5 329 4 weeks ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2320 8 months ago
Forms & Blueprints · by Hugo Oliveira, 9 months ago
0 781 9 months ago
Forms & Blueprints · by Flachy Joe, 10 months ago
9 871 10 months ago