Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**BUG** blueprint file upload no longer working correctly, creates folder at root of GRAV #3275

Open
MattAppleton opened this issue Mar 16, 2021 · 7 comments

Comments

@MattAppleton
Copy link
Contributor

MattAppleton commented Mar 16, 2021

I ran across this recently with a site with custom blueprint that has a file upload for a video background like so...

here's my 'default.yaml


extends@: default

form:
  fields:
    tabs:
      fields:
        content:
            type: tab
            fields:
              header.backgroundvideoupload:
                name: backgroundvideo
                type: file
                label: Background video upload
                multiple: false
                destination: '@self/videos'
                accept:
                  - video/*

              header.backgroundvideo:
                type: filepicker
                folder: '@self/videos'
                label: Select a background video
                preview_images: true

this USED to work fine, saving a file into the relevant page folder in a subfolder 'videos'

But now it creates a folder called '@self' with a subfolder 'videos' at the root level of the Grav install folder.

Just tested this on a completely vanilla fresh install of Grav 1.7.7 admin 1.10.6

I am trying to make a simple blueprint that uploads background images / videos into either a specific page or ideally a subfolder per page.

@MattAppleton
Copy link
Contributor Author

Seems Grav doesn't resolve blueprint folder .yaml such as

folder: 'page:/backs'

folder: 'self@/backs'

etc...

@mahagr
Copy link
Member

mahagr commented Mar 16, 2021

Related to #3225

@MattAppleton
Copy link
Contributor Author

@mahagr Thanks for looking... so I can resolve with that repo update?

@mahagr
Copy link
Member

mahagr commented Mar 17, 2021

@MattAppleton I'm working on the second part of the fix based on the blueprints you gave to me, but I need a bit more time to get it right.

mahagr added a commit that referenced this issue Mar 17, 2021
@mahagr
Copy link
Member

mahagr commented Mar 17, 2021

Also needs a fix in trilbymedia/grav-plugin-flex-objects@e4f2e29

@mahagr
Copy link
Member

mahagr commented Mar 17, 2021

@w00fz There is still a bug in displaying above file field. It gets the files from the main media object, not from the media object from that input. I have fixed the field so it mostly works, but it cannot be fully fixed before the right settings are being used.

AJAX call is not sending name in POST containing the field name, in above case header.backgroundvideoupload.

Basically you need to change themes/grav/app/pages/page/media.js line 76+ fetchMedia() method to work just like add/delete.

@w00fz
Copy link
Member

w00fz commented May 27, 2021

This works fine for me, seems resolved.
There is no point in sending the name for that location you specified @mahagr, that's pagemedia and uses its own listmedia task, it's always just pagemedia.

the header.backgroundvideoupload field is of type file, which uses the task getFilesInFolder and that is already properly sending the necessary information needed:

w00fz-2021-05-27_@_12 45 24@2x

w00fz-2021-05-27_@_12 47 18@2x

w00fz-2021-05-27_@_12 47 54@2x

@w00fz w00fz removed their assignment May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants