Closed
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;