getgrav / grav-plugin-form

Grav Form Plugin

Home Page:http://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Revisit: Field 'file' does not save file when used in front-end form

pamtbaau opened this issue · comments

This issue has been mentioned before, but hasn't been addressed properly so far.

Note: This issue only occurs in front-end forms, not when used in blueprints.

The following form does not save the file:

form:
    name: upload
    fields:
      myfile:
        type: file
        label: Uploads
        destination: 'user/data/upload'
        multiple: true
        autofocus: false
        accept:
          - image/* 
    buttons:
      - type: submit
        value: Submit
    process:
      reset: true
      message: Thanks!

In this case, action 'reset' is performed before action 'upload'. Since 'reset' clears the flash containing the upload info, there is nothing to save anymore...

Workarounds until issue has been fixed:

  • Add action 'upload' in form definition. Like:
    process:
      upload: true 
      reset: true
      message: Thanks!
    
  • Remove action 'reset', but this may have unwanted side effects.