silverstripe / silverstripe-asset-admin

Silverstripe assets gallery for asset management
BSD 3-Clause "New" or "Revised" License
20 stars 79 forks source link

Setting max_upload_size #1272

Closed markdynamo6 closed 2 years ago

markdynamo6 commented 2 years ago

Is there a reason why getAllowedMaxFileSize in UploadField returns:

$this->getValidator()->getLargestAllowedMaxFileSize()

and not:

$this->getValidator()->getAllowedMaxFileSize()

?

We are trying to set max_upload_sizes in config.yml

GuySartorelli commented 2 years ago

Upload_Validator::getAllowedMaxFileSize() is a bit more nuanced than Upload_Validator::getLargestAllowedMaxFileSize() - depending on configuration, the former might return false when there is actually a valid maximum allowed file size available. The latter method will always return the maximum allowed file size for the field.

max_upload_sizes doesn't seem to be a configuration variable (or any sort of variable). You probably want to set default_max_file_size on SilverStripe\Assets\Upload_Validator.

I'm going to close this issue now - the issue tracker isn't a place to ask support questions. Please use stackoverflow, the forum, or the public slack for that.

markdynamo6 commented 2 years ago

Cheers Guy.

All good. I'll pursue the question on stack overflow.

I only raised it here because it seems strange, and manifests as a bug. default_max_file_size was indeed the variable I meant and is still ignored by the UploadField - even though it is not by the main File Manager interface.