move upload to the cb function