-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
FeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Validator
Description
The File
constraint should support the following notations for the "maxSize" option:
new File(array('maxSize' => 1234)); // bytes
new File(array('maxSize' => '2k')); // kilobytes (case insensitive)
new File(array('maxSize' => '2ki')); // kibibytes (case insensitive)
new File(array('maxSize' => '1m')); // megabytes (case insensitive)
new File(array('maxSize' => '1mi')); // mebibytes (case insensitive)
// etc.
The conversion of the passed value to the number of bytes should be done already in the constructor of File
, to simplify dealing with the file constraint:
$constraint = new File(array('maxSize' => '1ki'));
assert 1024 === $constraint->maxSize;
Metadata
Metadata
Assignees
Labels
FeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Validator