simplify upload logic