updated file upload handling