Buy Now
Sign in

file access permissions only from chrono page

teldrive , October 06 2021, 06:55
teldrive 644
October 06 2021, 06:55 #397198
Hi everyone
a simple question but may be not easy to solve
i have lots of links to files into my chrono list of type
how can I restrict access to them in order only they can be accesed from web page(that of course has user restrictions)
GreyHead 65
October 06 2021, 08:40 #397203
Hi teldrive,
I'm sure that this has been answered before but don't have time to hunt it down right now.
If I recall correctly the answer is to save the files in a folder above the domain root so that they are not directly available by URL, then create a form page that will download the file - or email it if you prefer. That form page can be limited to the appropriate restricted users.
If you'd like to buy me a coffee or two, thank you very much
teldrive 644
October 06 2021, 20:13 #397205
Thanks Bob, yes it works, just to share my code with everyone , in link to file
and in CF a form called "descarga", the key of this method is that /trabajos/ is a private folder so only registered user can acces to it and files are in the /doc/ folder , same place that /httpdocs/ folder, where only php program can access, I understand thtat this is the most secure method
$parts = explode('/', $path_root);
$this->data['path2'] = implode('/', $parts).'/docs/'.$this->data['file'];