It would be really nice if Drupal had the ability to notify other modules when a private file was finished transferring so things could be done such as marking the file as already downloaded so it couldn't be downloaded again. The best you can do currently is stick this logic in hook_file_download(), but if the file fails to transfer for whatever reason, it will get erroneously marked as downloaded when it's not. Angry e-mails ensue.

As a workaround, I had to copy/paste/rename file_transfer() into my custom module and add my download-checking logic just before exit(); which is pretty meh.

Comments

Damien Tournoud’s picture

I wonder how that could play with fast private transfers we could implement using X-Sendfile headers. I'm not sure we have the information "the transfer succeeded" in that case.

drewish’s picture

webchick’s picture

Status: Active » Closed (duplicate)

It does indeed!