Problem/Motivation
Drupal\file\Plugin\Field\FieldType\FileItem::getUploadValidators()
always sets the maximum file size for uploading based on post_max_size
and upload_max_filesize
PHP settings.
That prevents us from avoiding max file size validation for some use-cases. A typical use case where this would be helpful is when files are not stored on the same server as Drupal (e.g. they are stored in a remote file system, S3).
Proposed resolution
Let file size validator use max_filesize
setting if it is explicitly configured (not empty) only.
Otherwise, we should either skip file_validate_size()
completely or do the call and indicate that no file size limit should be enforced.