verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 68 forks source link

File Upload field shows all previous uploaded files on directory #1935

Open cookie10codes opened 1 week ago

cookie10codes commented 1 week ago

Describe the bug

When I use a File Upload, the field shows all the uploaded file ons the project. I don't see anything specific in the settings and don't do anything specific.

Screenshot 2024-06-17 at 15 27 55

Steps to reproduce

  1. Drag File Upload on the form builder
  2. Set location to specific asset folder

But I see all the files on all folders listed out

Form settings

Craft CMS version

Craft Pro 5.2.0

Plugin version

3.0.0-beta.15

Multi-site?

No

Additional context

No response

engram-design commented 1 week ago

That's strange, I can't seem to replicate that. So there's literally no other settings changed apart from the location to upload? And these files show up as soon as you load the form on the front-end?

cookie10codes commented 1 week ago

hi @engram-design,

Sorry was a bit of a short turn there. I do have a populate fields object, but the cv (which is the handle of the field) has null in it (the idea is that I read the field from the user CV upload and add it populated in there, currently I just pass null)

{%- set populateFields = {
        about: user.about,
        email: user.email,
        firstName: user.firstName,
        lastName: user.lastName,
        jobTitle: user.jobTitle,
        telephone: user.telephone,
        inss: user.inss,
        about: user.about,
        cpUserId: user.id,
        cv: null,
} -%}
engram-design commented 6 days ago

Ah right, that might be problematic, not to mention that won't work anyway. Firstly, that's going to load up the Asset element query with a null ID, so it's going to fetch all assets. I can add a check for that.

Secondly, you can't populate a FIle Upload field like this, because the <input type="file"> cannot be populated as a browser restriction. We want to get around this by implementing a drag drop field at one point.