Buy Now
Sign in

file access permissions only from chrono page

teldrive , October 06 2021, 06:55
teldrive 636
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 http://myweb.com/2021/file.pdf
how can I restrict access to them in order only they can be accesed from web page(that of course has user restrictions)
Teldrive
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.
Bob
If you'd like to buy me a coffee or two, thank you very much
teldrive 636
October 06 2021, 20:13 #397205
 Answer
Thanks Bob, yes it works, just to share my code with everyone , in link to file
 https://myweb/trabajos/?option=com_chronoforms6&chronoform=descarga&file=file1.pdf
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
if($this->data['file']){
$path_root=JPATH_SITE;
$parts = explode('/', $path_root);
array_pop($parts);
$this->data['path2'] = implode('/', $parts).'/docs/'.$this->data['file'];
}
Teldrive