Reference

file.create:before

$file, $upload

Example

/site/config/config.php
return [
    'hooks' => [
        'file.create:before' => function ($file, $upload) {
            // your code goes here
        }
    ]
]