yii2-file-upload-widget icon indicating copy to clipboard operation
yii2-file-upload-widget copied to clipboard

Data does not saving

Open SerikK opened this issue 8 years ago • 2 comments

Hi. Extension is saving images, but it does not save to attributes of model. As I see there are two inputs are created: and . And when I catch it in controller it does not return me anything in images attribute. I have the following configuration:

FileUploadUI::widget([
        'model' => $model,
        'attribute' => 'image',
        'url' => ['projects/imageupload', 'id' => $model->id],
        'gallery' => false,
        'fieldOptions' => [
                'accept' => 'image/*'
        ],
        'clientOptions' => [
                'maxFileSize' => 2000000
        ],
        'clientEvents' => [
                'fileuploaddone' => 'function(e, data) {
                                    }',
                'fileuploadfail' => 'function(e, data) {
                                    }',
        ],
    ]);

Can you explain how I can solve this?

SerikK avatar Jul 14 '16 20:07 SerikK

@SerikK ~~please, show your $image attribute rules and the action handling the upload~~

We have to do a bit of extra work here. The extension allows you to submit images, so the way to handle submissions is by using UploadedFile and then we need to set the attribute of our model programmatically to the source of the image. Is that what you do? Can you show me your code for uploading?

tonydspaniard avatar Sep 10 '16 17:09 tonydspaniard

check latest additions to the master to find out whether you were doing something wrong or not: https://github.com/2amigos/yii2-file-upload-widget/tree/master/src/actions

tonydspaniard avatar Sep 27 '16 09:09 tonydspaniard