I stored the names of some users in one table and they should be able to download certain files from private folder(not other users). As i see i have to use hook_file_download
In the page of that hook it is said:
If the user does not have permission to access the file, return -1. If the user has permission, return an array with the appropriate headers.
I don't understand which array should be returned exactly! my file in private folder is mp4 file and user has to see save page.
some users file_create_url() but i don't know how to use it inside hook_file_download. can u give me one example code?
thanks in advanced for your help
edit: I found this code here:
if ($can_access_file) {
$headers = file_get_content_headers($file);
return $headers;
}
I don't know exactly how to provide with $file! here is file_get_content_headers help