Is it possible to restrict files from your wordpress uploads (not logged-in users or guest)?

Please go through this blog written by me. Here you will get your answer for your question.

https://aftabablog.wordpress.com/2017/02/17/how-to-make-your-uploads-in-wordpress-visible-only-for-logged-in-users/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)