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

Files Fieldtype: max_files: 1 doesn't prevent uploading more than 1 file #11197

Open
duncanmcclean opened this issue Nov 29, 2024 · 1 comment

Comments

@duncanmcclean
Copy link
Member

Bug description

I discovered this while working on statamic/importer#47.

When you have a Files fieldtype, with max_files: 1, it allows you to upload multiple files, when it should only let you upload the one.

CleanShot.2024-11-29.at.11.42.09.mp4

How to reproduce

  1. Add a Files fieldtype with max_files: 1 (it's a hidden fieldtype, so you'll need to add it to your blueprint manually):
-
  handle: file
  field:
    type: files
    max_files: 1

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.30.0
PHP Version: 8.3.14
Composer Version: 2.8.3
Environment: local
Debug Mode: ENABLED
URL: importer-sandbox.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 1
Sites: 2 (Statamic, German)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.37.0 PRO

Statamic Addons
statamic/importer: 1.4.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member Author

As a workaround, you can add a max: 1 validation rule to ensure only 1 file can actually be uploaded.

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

1 participant