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