The uploaded file field is null in AttachmentBeforeCreateEvent

Hi all,

I am implementing a virus validation for the uploaded attachments.
I registered an event listener for AttachmentBeforeCreateEvent as suggested by Tomas, please see the comment in this ticket A12-11873.
But my uploaded file gets NULL in AttachmentBeforeCreateEvent. I dont know what am I missing. Does anyone have any idea? Thanks in advance

What I did:

  • I called the rest endpoint “/api/attachment/upload” provided by a12
  • I registered an event listener to listen to AttachmentBeforeCreateEvent

Hi @quynh-still-birch, Thank you for your question.
As I checked, the solution in ticket A12-11873 is not used anymore.
attachmentBeforeCreateEvent.getUploadedFile isn’t suitable for your case.

To get your file, please follow below:

Supplier<? extends InputStream> attachment = attachmentBeforeCreateEvent.getAttachment().getContent();

Let me know if you have any issue