Hello, I trying with CallbackAfterUpdate and it’s working. So it’s not a general problem with callback, only with callback after Upload. Even the file is really uploaded.
I can’t reproduce the issue that you are describing. Maybe it has to do with mail function it self? I’ve tried with this code and it is working:
$crud->callbackAfterUpload(function () {
// Song from Red Hot Chili Peppers :)
var_dump("🎵 How loooooong, how loooooong will I slide?
Separate my side, I don't
I don't believe it's bad
Slit my throat it's all I ever 🎵");
die;
});
And the message is displayed after the upload. Can you try to var_dump() a message to see if this appears to your screen?
Also please keep in mind that this callback is only if you have a file to upload. For example if you have a file to upload on “Browse” button. If you are editing a record and the file is already uploaded the callback will not be triggered. Hope it make sense.
It’s the firtst test i had doing. But nothing is displayed, and the program continue as if there is no die !. The upload is doing fine, but not the callback, very strange.
Now I have writed a little workaround, I downscale my picture a the reading of news. But it’s not a perfect solution, and there is vraissembly a problem somewhere in my grocerycrud install ?
After searching around I think I’ve find the issue of why this is not working🕵️ (and more specifically this post Upload field. How to store the full path in database? - #4 by johnny ). There was a bug on callbacks for upload and they weren’t working at all. This is not clearly mentioned at the documentation, either at the forums. This is fixed on version 3.0.9 and later. I would suggest to upgrade to the latest version (3.0.10) from here: User's Page Login
Let me know if after the upgrade you are still having the same issues.
Thank you for your help, is there a way to display my actual version of GroceryCrud, it seems that : echo GroceryCrud::VERSION not yet working in V3.xx
Yes this was an issue reported by @larasmith and I’ve fixed it starting from version 3.0.10 and later. So only after this version onwards you will see the version.
So you can now see the version from PHP. Another way to check the version in older versions is to check the folder public/vendor/grocery-crud/static/js/ and search for a file with name “bundle” so for example at the last version we use the file “bundle.v3.0.10.60706269.js” so v3.0.10 is the Grocery CRUD version you use.