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

File upload on form

Started by Muut Archive 10 years ago · 7 replies · 565 views
10 years ago

Hi all. I have problem with file uploading on website form.
I have this code in frontpage.md

YAML
forms:
    contact-form:
        fields:
            - custom_file: fileds
              type: file
              label: 'Upload file'
              destination: 'user/downloads'
              multiple: true
              avoid_overwriting: false
              limit: 10
              filesize: 5

Site shows file input ,but without any labels and actions. Anybody knows why it is not working? Please help

10 years ago

@rhukster exactly this code ?And all is fine?

10 years ago

Make sure indenting is all ok. Try adding a new line after the - (keep it on a line alone)

10 years ago

@flaviocopes thanks ,all is working. But, i have another problem, when i tried to delete just uploaded file. Grav can not remove file. It requires some 'gran-n.json' file ,where 'grav-n' is project name.I did not find the answer in the documentation and can not understand what could be the problem. Screen Shot 2016-10-28 at 13

10 years ago

@arrtych1 how did you fix your file upload issue? I have the same issue and can't make it work. I'm using the deliver theme.

my code:

YAML
    -
        name: message
        label: Message
        classes: 'form-control form-control-lg'
        size: long
        placeholder: 'Votre message'
        type: textarea
        validate:
            required: true
    -
        custom_file: thefiles
        type: file
        label: 'vos photos'
        multiple: true
        destination: user/upload
        accept: 
            - 'image/*'

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1349 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2946 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago