How to protect upload folder from being indexed in WordPress
open the .htaccess file on the root directory and add this at the end:
Options -Indexes
This will help prevent anyone from viewing the content of the uploads folder. It will protect the uploads folders and all the dated folders inside.