

def upload(self, filename, directory=None):
    '\n        Upload a file ``filename`` to ``directory``\n\n        :param str filename: path to the file to upload\n        :param directory: destionation :class:`.Directory`, defaults to\n            :attribute:`.API.downloads_directory` if None\n        :return: the uploaded file\n        :rtype: :class:`.File`\n        '
    filename = eval_path(filename)
    if (directory is None):
        directory = self.downloads_directory
    res1 = self._req_upload(filename, directory)
    data1 = res1['data']
    file_id = data1['file_id']
    res2 = self._req_file(file_id)
    data2 = res2['data'][0]
    data2.update(**data1)
    return _instantiate_uploaded_file(self, data2)

dataset/ETHPy150Open shichao-an/115wangpan/u115/api.py API.upload/original