CodeIgniter Forums

Full Version: Direct Links to HTML files in a Directory a Bad Idea?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]zimco[/eluser]
My CI application has a folder full of straight HTML files that i would like to give access to the user to open and read in their browser thru a list of direct links to the files.

The list of all files in this directory was gotten by using the get_filenames('path/to/directory/') method from the CI helper['file'] in a controller, then the list of files names was passed to the view. Where I created the links to all the files with the following statement in the view:

Code:
//Generate links to files
echo ('<a href="'. base_url() . 'system/application/stockhtml/' . $filelist[$i] . '">'. $filelist[$i] . '</a><br/>');

Is it safe to create the link to the files in the stockhtml directory the way i have done it above? Or is there a better way to do it? Is exposing the 'system/application' part of the path to the user in the URL bad?

El Forum

[eluser]mironcho[/eluser]
In my opinion it's better to place this directory outside system/. Nevertheless, if you want to store these files within system/application/, would be better to output them from some controller (e.g. with readfile()Wink instead of giving direct access to them...