move local upload stuff in to separate libs