Move file attribute extraction out of controller.