primary upload function ok