inlineEditFields fails with upload field

Hi Johnny
The inline editing feature is fantastic. I have a custom function to view images from an Upload Field in Laravel’s storage.
When saving the inline editing of another text field that isn’t related to the upload field, it fails.

The controller is named EncuestadorController.php

MY code
$crud->setFieldUpload(‘foto’,‘fotos/’,url(‘/’).‘/encuestador/fotos/’);

$crud->inlineEditFields([‘contacto’]);

public function fotos($foto){
    $filename = $foto;
    $data = Storage::get('fotos/'.$filename);
    return response()->make($data, 200, [
        'Content-Type' => 'image/jpeg',
        'Content-Disposition' => 'inline; filename="'.$filename.'"'
    ]);
}

crud->callbackBeforeUpload(function ($uploadData) {
        $new_file = bin2hex(random_bytes(4 / 2)) . '_' . $_FILES["data"]["name"]["foto__gcrud_upload"][0];
        $_FILES["data"]["name"]["foto__gcrud_upload"][0] = $new_file;
        $_FILES["data"]["full_path"]["foto__gcrud_upload"][0] = $new_file;
        Storage::putFileAs('fotos/', $_FILES["data"]["tmp_name"]["foto__gcrud_upload"][0], $new_file);
        return $uploadData;
 });

If the controller class does not have UploadField, everything is fine.

Hello @NOLO ,

First of all thank you for the feedback :grinning:. I am glad you liked inline edit functionality. I can indeed see the issue that you are referring to and this is a defect which I was able to reproduce and also fix.

I am preparing a release for that but it may be delayed a little bit since I am trying to also include a fix for Mulitgrid Security Errors ( CSRF?)

I will keep you up to date once the new version is available.

Regards
Johnny

1 Like

Hello @NOLO ,

I am glad to inform you that this is now fixed at the latest version 3.2.3 , you can upgrade to the latest version following the wizard instructions easily: User's Page Login

Regards
Johnny

1 Like

Muchas gracias, amigo!

1 Like