mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 22:43:47 +01:00
LSformRule :: filesize : improve by avoiding to create a temporary file
This commit is contained in:
parent
958c5b16a8
commit
07cdad29a4
1 changed files with 4 additions and 3 deletions
|
@ -39,9 +39,10 @@ class LSformRule_filesize extends LSformRule {
|
|||
* @return boolean true si la valeur est valide, false sinon
|
||||
*/
|
||||
public static function validate ($value,$options,$formElement) {
|
||||
$file = LSsession :: getTmpFile($value);
|
||||
|
||||
$size = filesize($file);
|
||||
// According to PHP doc, strlen() returns the number of bytes rather
|
||||
// than the number of characters in a string.
|
||||
// See: https://www.php.net/manual/en/function.strlen.php
|
||||
$size = strlen($value);
|
||||
|
||||
$maxSize = LSconfig :: get('params.maxSize', null, 'int', $options);
|
||||
if (is_int($maxSize) && $size > $maxSize)
|
||||
|
|
Loading…
Reference in a new issue