Extra defensive code around upload