'Uploads a file to the hosting service.
Must only be called after Begin().
The path provided must be one of those that were returned by Begin().
Args:
path: The path the file is being uploaded as.
file_handle: A file-like object containing the data to upload.
Raises:
KeyError: The provided file is not amongst those to be uploaded.'

def UploadFile(self, path, file_handle):

    assert self.in_transaction, 'Begin()    must    be    called    before    UploadFile().'
    if (path not in self.files):
        raise KeyError(("File    '%s'    is    not    in    the    list    of    files    to    be    uploaded." % path))
    del self.files[path]
    file_classification = FileClassification(self.config, path, error_fh=self.error_fh)
    payload = file_handle.read()
    if file_classification.IsStaticFile():
        upload_path = path
        if file_classification.IsApplicationFile():
            upload_path = ('%s/%s' % (STATIC_FILE_PREFIX, path))
        self.blob_batcher.AddToBatch(upload_path, payload, file_classification.StaticMimeType())
    if file_classification.IsErrorFile():
        self.errorblob_batcher.AddToBatch(file_classification.ErrorCode(), payload, file_classification.ErrorMimeType())
    if file_classification.IsApplicationFile():
        self.file_batcher.AddToBatch(path, payload, None)
