Open rezahmady opened 2 months ago
Hey @rezahmady
I just tested it, and it works for me. Here is what I did:
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation { update as traitUpdate;}
public function update(){ $single_pixel_base64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="; // modify image before saving $this->crud->getRequest()->request->add(['main_image' => $single_pixel_base64]); $response = $this->traitUpdate(); // do something after update return $response; }
public function store(){ $single_pixel_base64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="; // modify image before saving $this->crud->getRequest()->request->add(['main_image' => $single_pixel_base64]); $response = $this->traitStore(); // do something after save return $response; }
Field Definition:
```php
CRUD::field('main_image')
->label('Main Image')
->type('image')
->tab('Media')
->wrapper(['class' => 'form-group col-md-4'])
->fake(true)
->withFiles(['path' => 'images']);
Bug report
What I did
in store method i want to change field : my field :
i want to change field value :
or
This api works well with fields that do not have the withFiles attribute
What I expected to happen
field value save correctly.
What happened
field value is null.
I know that you are working on the redesign of the upload field, but this issue is very important to me and I cannot wait until you finish that task. If possible, check and fix this issue.