refactoring upload file