Optimization about upload function.