Improved file upload handling