Fix upload failure handling. (see #11061)

See https://trac.openmicroscopy.org.uk/ome/ticket/11061 for testing steps