Fix and clean file upload