You have indicated the wrong one maxSize.
From official docs:
The maximum number of bytes required for the downloaded file. The default values ββare null, which means no restrictions. Note. The size limit also depends on the 'upload_max_filesize' INI and the hidden field 'MAX_FILE_SIZE' value.
See also $ tooBig for a customized message for a file that is too large.
500 kilobytes - 500 * 1024 bytes = 512,000 bytes.
public function rules()
{
return [
['myfile', 'file', 'extensions' => 'pdf, jpg', 'maxSize' => 512000, 'tooBig' => 'Limit is 500KB'],
];
}
'maxSize' => 500 * 1024, , - ( ).
: