How to access images under writable folder |
(08-04-2020, 12:09 PM)jreklund Wrote: You need to upload them to /public/uploads or make a PHP-reader that reads the image from writable/uploads and outputs it to the user, with a correct mime type. To resurrect a theme: I need to make some uploaded files available only to logged-in users. I guess one way to do that would be to put the upload files into a public directory while rewriting their names into some md5 string, like nice-picture_a03384874133c262676aab57fecb8ced.jpg , so that without a link pointing to it there would be no easy way to get the image. But I see you also suggest to "make a PHP-reader" - could someone point me in the right direction on how that is to be done? What would be the-codeigniter-way of allowing access to files outside public directory? I have found this code example online, is it the way to go? I imagine it would go into some controller that would be provided as src link with the name of the file I want to provide as first argument (segment) after the controller name in an html page... PHP Code: $file = '/absolute/path/to/file.ext';
==
Donatas G. |
Welcome Guest, Not a member yet? Register Sign In |