Can't upload files larger than 97.66 KB in Yii2 Framework with Kartik's FileInput widget

Gaston Berenstein

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.

Reborn

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.

edited at
0

Comments

0 comments
Login to comment

Related

Can't upload files larger than 50kb with AJAX

I can't upload files larger than 8 mb

kartik fileinput error in yii2

can not upload larger files

Error: This page can't be reached in Kartik Yii2 Export

yii2 kartik FileInput - File input empty

Yii2: Increasing FileInput width using ActiveForm of kartik

Showing video thumbnails in kartik-v/yii2-widget-fileinput

Kartik's star-rating widget not working in foreach construction in Yii2

Can't transfer files larger than 2GB to FAT32 USBs on MacOS HighSierra

Using Fileinput to upload files

Yii2 widget fileinput utf-8 charset problem

yii2: get relation data in kartik editable widget

Yii2: Using Kartik DepDrop widget outside an ActiveForm

Yii2 - Kartik Widget-Rating overwrite values

What is $catList in depdrop - Kartik yii2 widget scenario 1?

fileinput upload and preview, protect files

Issue with multiple files in Cloudinary's upload widget v2

Can't upload files

VC++ 2012 can't read files larger than 4 GB

Use Yii2's Autocomplete widget to query more than one table

Yii2: Using TinyMCE into Kartik's DetailView with custom settings

How to update multiple images in kartik Upload widget?

RSA block by block encryption produces blank output for files larger than 1kb

How to write files larger than 2 GB?

SHCreateStreamOnFileEx on files larger than 2**32 bytes

Very slow (~2KB/s) network file transfer of files bigger than a specific size, no matter the OS

DynamoDB larger than 400KB items

yii2 - All Files and Folders permissions are messed up. What should be the permissions of yii2 framework's directory hierarchy

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive