Refactoring file uploader behaivor.