Improve controller for file upload