0

I'm looking for a solution to check which users fully downloaded a specific download/file. I found several solutions to detect whether a download/file is completed. F.e. https://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download But this use case is quiet different. I need to retrieve a list of people who downloaded the file afterwards.

Thanks in advance.

1

If you have file_entity installed, you can use hook_file_transfer() with a custom function my_custom_registration($file, $user) that registers which user downloaded which file The starting code for that is :

/**
 * Implements hook_file_transfer().
 *
 * @param type $uri
 */
function my_module_file_transfer($uri) {
  global $user;
  $files = file_load_multiple(array(), $conditions = array('uri' => $uri));
  if (!empty($files)) {
    $file = reset($files);
    my_custom_registration($file, $user);
  }
}

hope this helps

  • That won't help to confirm that the file has been downloaded, just that the download was requested/started at some point – Clive Sep 24 '18 at 9:16
  • @izus, thanks for you answer but as Clive mentioned this only keeps track of the requested/started downloads not if the file was 100% completely downloaded. – kim.kaho Sep 24 '18 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.