Media Utils: Allow limiting uploads to a single file #68629
Labels
[Feature] Media
Anything that impacts the experience of managing media
[Package] Media Utils
/packages/media-utils
[Type] Enhancement
A suggestion for improvement.
A proposal to update the
uploadMedia
method and allow limiting uploads to a single file. WhenfilesList
exceeds the set limit, the function will call anonError
callback and exit early.Why?
The
mediaUpload
setting, which utilizes this method, is often used with theDropZone
component. This component allows any number of files, but consumers only see and use the first file.Currently, restrictions need to be set on the consumer level. Examples:
gutenberg/packages/block-editor/src/components/background-image-control/index.js
Line 316 in 0c42f22
gutenberg/packages/block-library/src/site-logo/edit.js
Line 509 in 0c42f22
Proposal
Introduce a new boolean
multiple
boolean argument foruploadMedia
andmediaUpload
methods. Themultiple
also matches the prop used by theMediaUpload
component.cc @swissspidy, @t-hamano
The text was updated successfully, but these errors were encountered: