docs: def upload(self,
                 file,
                 name=None,
                 prefix=None,
                 extensions=None,
                 overwrite=False,
                 public=False,
                 random_name=False,
                 **kwargs):
          """
          To upload file
          :param file: FileStorage object or string location
          :param name: The name of the object.
          :param prefix: A prefix for the object. Can be in the form of directory tree
          :param extensions: list of extensions to allow. If empty, it will use all extension.
          :param overwrite: bool - To overwrite if file exists
          :param public: bool - To set acl to private or public-read. Having acl in kwargs will override it
          :param random_name - If True and Name is None it will create a random name.
                  Otherwise it will use the file name. `name` will always take precedence
          :param kwargs: extra params: ie: acl, meta_data etc.
          :return: Object
          """
          tmp_file = None
          try:
              if "acl" not in kwargs:
                  kwargs["acl"] = "public-read" if public else "private"
              extra = kwargs
  
              # It seems like this is a url, we'll try to download it first
              if isinstance(file, string_types) and re.match(URL_REGEXP, file):
                  tmp_file = self._download_from_url(file)
                  file = tmp_file
  
              # Create a random name
              if not name and random_name:
                  name = uuid.uuid4().hex
  
              # coming from a flask, or upload object
              if isinstance(file, FileStorage):
                  extension = get_file_extension(file.filename)
                  if not name:
                      fname = get_file_name(file.filename).split("." + extension)[0]
                      name = slugify.slugify(fname)
              else:
                  extension = get_file_extension(file)
                  if not name:
                      name = get_file_name(file)
  
              if len(get_file_extension(name).strip()) == 0:
                  name += "." + extension
  
              name = name.strip("/").strip()
  
              if isinstance(self.driver, local.LocalStorageDriver):
                  name = secure_filename(name)
  
              if prefix:
                  name = prefix.lstrip("/") + name
  
              if not overwrite:
                  name = self._safe_object_name(name)
  
              # For backwards compatibility, kwargs now holds `allowed_extensions`
              allowed_extensions = extensions or kwargs.get("allowed_extensions")
              if not allowed_extensions:
                  allowed_extensions = self.allowed_extensions
              if extension.lower() not in allowed_extensions:
                  raise InvalidExtensionError("Invalid file extension: '.%s' " % extension)
  
              if isinstance(file, FileStorage):
                  obj = self.container.upload_object_via_stream(iterator=file.stream,
                                                                object_name=name,
                                                                extra=extra)
              else:
                  obj = self.container.upload_object(file_path=file,
                                                     object_name=name,
                                                     extra=extra)
              return Object(obj=obj)
          except Exception as e:
              raise e
          finally:
              if tmp_file and os.path.isfile(tmp_file):
                  os.remove(tmp_file)