def seek(self, loc):
        """Called if upload fails and must be retried."""
        assert loc == 0

        # rewind progress bar
        if self.progressbar:
            self.progressbar.update(-self._fp.tell())

        self._fp.seek(loc)