Open chrispenny opened 1 year ago
You say feature request, but I'm going to label this a bug - I see no reason why the Upload_Validator::$default_max_file_size
configuration shouldn't be respected, given that's the validator used by UploadField
.
Yep, that'd be a bug. The PHP values should only be used as fallbacks if there's no other config provided.
Preamble
Uploads made through the Asset admin area can be restricted with configuration. EG:
(You can also set file size limits by specific file extensions)
The result is that any images being uploaded must be 2MB or smaller, and any other file type (documents, videos, etc) must be 6MB or smaller.
There is also an
Upload_Validator
that supports the same configuration (though I didn't really dig into where this class is used). EG:Problem statement
UploadField
s that have been added to (say) edit forms do not appear to respect either of these configurations, and I am able to upload images and documents that are larger than both of these limits.We were able to determine that the
UploadField
goes through theUploadReceiver::constructUploadReceiver()
, and this is setting the max upload size from PHP ini, rather than from our configurations:Also: Even if this was being fetched from configuration, it currently wouldn't support the categorisation that the
AssetAdmin
does.Feature request
Have the
UploadField
respect the configuration defined forAssetAdmin::$max_upload_size
orUpload_Validator::$default_max_file_size
(including the ability to specify limits for different categories and/or extensions).