I have a late 2012 iMac 21.5" computer that had a 1TB 5400rpm drive that failed. I did a LOT of research on how to upgrade it. Honestly, there were no definite posts that you could. So let me tell you that it can be done. I swapped my existing drive with a Samsung 850 EVO 1TB SSD and it worked perfectly. The only issue was getting the screen removed from the casing. After additional research, I settled on my daugther's guitar pick. Although a bit tedious (I didn't want to crack the screen or damage any internal components), it worked perfectly.
Once the screen was removed, it was a quick four screws to change the drive. I had no issues with the fans (Apple has some proprietary thermal computer / drive connection). The computer works perfectly and is much, much faster than the old 5400RPM drive. For $350, I have a new, wicked fast computer that I'm very happy with.