get_attached_file returns wrong path after changing media upload dir

I found the problem 🙂 Actually this is my friend’s website. I don’t have any idea how he changed the upload dir but I noticed that there is no define( 'UPLOADS', ''.'uploads' ); in his wp-config.php file. I added it and it’s now working perfectly. I hope this helps other people who will facing this problem.