I'd like to use the path alias in order to create the folder structure of the uploaded file. First of all I could not find the correct token in the list and after a while decided to create my own custom token.
It was working when the node had already been created and a new file was added but it failed when the node was created for the first time. It also failed with active update. It seems the token was not called again...
I also found those 2 hooks that could be useful but did not go very far with it: Should I be using hook_entity_presave() or hook_filefield_paths_process_file()
I would appreciate some pointers on how I could implement such a feature.