When I try to upload a file larger than 97.66 KB I get this error (translated from spanish):
"File is too large. Its size cannot exceed 97.66 Kib."
This is my widget setup:
Modal::begin([
//'title'=>'File Input inside Modal',
'header' => 'Agregar foto',
'toggleButton' => [
'label'=>'Agregar foto',
'class'=>'btn btn-default',
//'href' => Url::to(['afiliado/foto']),
'value' => Url::to('index.php?r=afiliado/foto&id=' . $model->id),
],
]);
echo $form->field($model, 'image')->widget(FileInput::classname(), [
'options' => ['accept' => 'image/*'],
'pluginOptions'=>[
'maxFileCount' => 1,
'allowedFileExtensions'=>['jpg','jpeg','gif','png'],
'showUpload' => false,
'maxImageWidth' => 2400,
'maxImageHeight' => 2400,
'resizeImage' => true,
'maxFilePreviewSize' => 10240,
'minImageWidth' => 50,
'minImageHeight'=> 50,
'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
'maxFileSize' => 1024
],
]);
Modal::end();
And in My php.ini, I set:
upload_max_filesize = 99MB
post_max_size = 100MB
Thanks in advance.
You need to get the file using UploadedFile::getInstance('image')
, and change you model rules to use maxSize
around 1024 * 1024 * 100
to set limit around 100MB
[['image'],
'file',
'skipOnEmpty' => false,
'extensions' => 'jpg, png, gif, jpeg',
'maxSize' => 1024 * 1024 * 100,
'tooBig' => 'The file was larger than 100MB. Please upload a smaller file.',
],
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments