How to get image info from lifecycle hook

System Information
  • 3.5.0:
  • Mac OS:
  • 14.15.3:
  • 6.14.9:

Hi everyone, I need to validate multiple image fields.
I found out that the best way for me to do so - run beforeCreate/beforeUpdate hooks on a model,
Then throw strapi.errors.badRequest("Image 1,3,5 got wrong format) - this will show an popup error for a user.
But how do I get image info (in data I get the image ID, and I didn’t found a way how to get image by it’s ID with strapi utilities)
Also, is there any way to show error not in a popup, but put it right to an image picker field?

Currently I’m just fetching the image out of


Is it correct way, or I can use something like strapi.getFileEntity(id)

Hey @Dzmitry_Baranau,

You could use the{id: imageId});.
This should give you the image object.