-
in yii1 can use allowEmpty and tooLarge
```
array('img', 'file', 'allowEmpty'=>true, 'types'=>'jpg, gif, png', 'maxSize'=>2097152, 'tooLarge' => '{file}files can not exceed 2MB. Please upload a small…
djfly updated
10 years ago
-
my AR:
``` php
public $pic_hold;
......
public function rules()
{
return [
['pic_hold', 'file', 'types' => ['gif']],
];
}
```
and my view:
``` p…
-
``` php
Object
(
[file] => yii\web\UploadedFile Object
(
[name] => montain.jpg
[tempName] => D:\servidores\xampp-php5511\tmp\phpEC86.tmp
[type] => imag…
-
I have rules in model
``` php
[['icon_image_file'], 'safe'],
[['icon_image_file'], 'image', 'types' => 'image/png', 'skipOnEmpty' => false],
```
Controller code:
``` php
if ($model->load($_POST) &…
-
Create ImageValidator with parametrs minHeight, minWidth, maxHeight, maxWidth. Maybe extend FileValidator.
-
The TypeValidator seems to be useless whenever the value being validated is NULL. It completely ignores the type I've configured it to enforce.
After debugging this for quite some time, it turns out …
-
I'm trying to set yii\validators\FileValidator to validate types of file in Model rules :
``` php
public function rules()
{
return array(
array('title', 'required'),
…
-
We can make validators more robust and universial. I have found that we have [addError() method](https://github.com/egorpromo/yii2/blob/62ca967743a8e3386ac8eb67523664aa6af515f2/framework/yii/validator…
-
Class FileValidator calls $file->getSize(), $file->getName().
There are no such methods in UploadedFile, so parent class Object calls static UploadFile::getName() and etc.
``` php
1. in D:\GitHub\y…
-
I have a file upload form for a CSV import.
When I upload a file, the mime type guesser is guessing "text/plain"
File-Object :
object(stdClass)# 597 (6) {
["**CLASS**"]=>
string(50) "Symfony\Co…