My php.ini:
upload_max_filesize = 10M
My model:
public function rules()
{
return [
[['user_id', 'name', 'description', 'image'], 'required'],
[['user_id', 'is_active'], 'integer'],
[['date_of_creation'], 'safe'],
[['name'], 'string', 'max' => 256],
[['description'], 'string', 'max' => 512],
[['players', 'level', 'time', 'best_time', 'fear', 'stress', 'teamwork', 'fun'], 'string', 'max' => 128],
['image', 'image', 'extensions' => 'jpg, gif, png, jpeg', 'maxSize' => 1024*1024*10, 'minWidth' => 100, 'minHeight' => 100],
];
}
My error:
Array ( [image] => Array ( [0] => The file "original_girl.jpg" is too big. Its size cannot exceed 2,097,152 bytes. ) )
Can enybody say what's wrong? In php.ini and in my model's rules I use 10 MB.
Did you set Post Max Size too?
post_max_size=10M
You also need to set post_max_size in php.ini
Try to change the post_max_size
directive in php.ini to send bigger files
post_max_size = 10M
And restart Apache
you use this one.....
[
['image'],
'file',
'extensions' => 'jpg, gif, png, jpeg',
'checkExtensionByMimeType' => false,
'maxSize' => 1024*1024*10
],
And change your .ini file