Reputation: 263
A script on my website uploads images to mysite.com/uploads
and generates a path to the image uploaded like mysite.com/uploads/123456789.jpg
.
The image should only to visible to users with a path to the file. The folder shouldn't list out its contents.
The script is built using PHP and runs on a Linux system (CentOS) managed by cPanel. I am new to Linux and I don't understand how this can be done and I need your help with it.
Upvotes: 0
Views: 633
Reputation: 402
I beleive that's not PHP issue. If you using Apache webserver you need a .htaccess
file in that folder with the following content:
Options -Indexes
And also you can try simply add empty file index.html
in each directory you'd like to hide.
Upvotes: 4