Disable Direct Download of Files

I'm running openlitespeed wordpress on google cloud. I'm trying to disable direct download of files in my upload folder (i.e. /var/www/html/wp-content/uploads). I want these files to still be accessible when viewed on my site, but I want to avoid users from directly downloading the files if they were to input the file URL into their browser. After some google searching I've tried editing the .htaccess file to achieve this but have been unsuccessful. Does anyone know how to achieve this?

Thank you!