0

I have a media video content type that has a video file field (takes a file), name, and air date. The video files are saved on amazon S3 not locally.
I want to monitor the files that are uploaded and get an email (that has the file name, file size, and URL) every time a file of 100MB or more is uploaded even before the node is saved when the user is still on the add/edit form. How can I do that I looked into hook_entity_insert and file_presave or another option?
But I am a bit confused as to which one will be the best and how to implement it.

8
  • You could look at hook_file_validate(). Though if this is a standard Drupal file field it might be preemptive to send an email before entity save in case the user decides to switch the file before entity save? Sep 2, 2022 at 4:44
  • hook_node_insert sounds good, get the file, check its size and programmatically send the mail you want.
    – leymannx
    Sep 2, 2022 at 4:53
  • @Prestosaurus, I want an email sent as soon as the file is uploaded to S3. Whether the file is changed or not after upload or the node is saved or not. I just want a way to track the big files uploaded to S3. Thanks
    – mamesaye
    Sep 2, 2022 at 14:27
  • @leymannx hook_node_insert is related to the node itself which does not work if the user changes files before saving the node. I want to track the files uploaded whether the file is changed or not after upload or whether the node is saved or not. Thanks
    – mamesaye
    Sep 2, 2022 at 14:30
  • 2
    Does this have to be implemented in Drupal? AWS has many options to monitor S3. docs.aws.amazon.com/AmazonS3/latest/userguide/…
    – cilefen
    Sep 2, 2022 at 15:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.