Two men are in hospital after a flat fire, the emergency services have said.