- bug report? yes
- feature request? no
- version: 2.4
Description
Hi,
i have use case
$form->addUpload('csv')
->addRule($form::MIME_TYPE, 'Foo', 'text/*')
// next line does not work
->addRule($form::PATTERN, 'Message', '*.csv');
I found in Validator::validatePattern where first parameter is (IControl)->getValue(). It's ok. If i look at (FileUploadControl)->getValue() you get FileUpload and method __toString return tmpName. Where is problem? I don't need run validation on temporary name, but on original name.
For first validation check extension of file. Please you don't write, this valid is not relevant. I can't use PATTERN validation for this moment.
Or throw exception, this rule is not relevant for FileUpload. Because here is wtf behavior.
I understant if you change return value in method __toString(), it can be BC break or anything worse.
Description
Hi,
i have use case
I found in Validator::validatePattern where first parameter is (IControl)->getValue(). It's ok. If i look at (FileUploadControl)->getValue() you get FileUpload and method __toString return tmpName. Where is problem? I don't need run validation on temporary name, but on original name.
For first validation check extension of file. Please you don't write, this valid is not relevant. I can't use PATTERN validation for this moment.
Or throw exception, this rule is not relevant for FileUpload. Because here is wtf behavior.
I understant if you change return value in method __toString(), it can be BC break or anything worse.