Customize controller for uploading profile picture in user-permission

Thank you for your advice. But it gets a 500 error