Implement hook_file_download as an event to control file download
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3530246. -->
Reported by: [anaconda777](https://www.drupal.org/user/3595801)
Related to !546 !535
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>For GDPR I have to create "download my data" for users.<br>
With ECA and Views data export I am able to create CSV files on a server private file folder which<br>
has the user data. But they cant be accessed by anyone, even admin, because there should be also a FILE entyty?</p>
<p>I have tried all possible ways to create a File entity with ECA, but always its a "access denied"<br>
<strong>Access denied to create file (Activity_157tghw) from ECA Export user data (process_bscgf0f) for event eca.form.submit:</strong></p>
<p>So I have tried to create a file "entity: create new" and selected File:file.<br>
Then after that tried to apply all necessary fields like status, uri, etc.<br>
But nothing works. Server folder permissions are maxed out 777 and www-data. The user is admin<br>
who tries to create the file, it is changed at the beginning of the ECA model. </p>
<p>Tried to save a file also to public folder but same problem. </p>
<p>Is there a tutorial how to create File entities with ECA and views data export? </p>
<p>I am able to create normal content entities but it looks like Files are different.<br>
Files may need something more, its not maybe enough the file uri, status etc but more.<br>
What could it be? </p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue