callbackAfterUpload(callable $callback)

The callback that will be triggered right after the upload.

For example the below code will show us an error at the page (so we can dump the data after the upload):

$crud->callbackAfterUpload(function ($test1) {

    return false;
  public 'filename' => string 'my-image.png',
  public 'filePath' => string '/Uploads/my-image.png',
  public 'fieldName' => string 'profile_thumbnail' // <-- Available at version 2.4.0 or higher

A very common usage of the callbackAfterUpload in order to resize the image right after the upload. For example:

// Add this at the beginning of your file. 
// For more instructions of how to install it with composer
// go to:
use Eventviva\ImageResize;
$crud->callbackAfterUpload(function ($data = null) {
   $fullPath = '/path/to/upload/folder/' . $data->filename;   

   $image = new ImageResize($fullPath);
   $image->resizeToBestFit(500, 300);

    return $data;