I've been exploring the issue of allowing web site visitors to securely upload images. I've come across this article: Long article about securly uploading images
It seems that the most important thing is to store the files outside of the document root.
Now, if i understand correctly, the "document root", in the case of using XAMPP, for instance, is what $_SERVER["DOCUMENT_ROOT"] gives, which is C:/xampp/htdocs
in my case. So putting my upload directory "outside" of it would mean creating a directory in C:/xampp. Am i right?
Anyway, I've tried doing so, and couldn't load the images in the template. The image source would always be interpreted as having "http://localhost..." in the beginning, and therefore the file can't be found.
I saw on that article that a function called readfile() needs to be used, but i have no clue how to implement it on Twig.
I would appreciate any help resolving this issue.
 
     
    