Upload an image and return its path on the server.
        Either `file_obj` or `file_path` or `name` and `data` has to be specified.

        :param file_obj: A file object to upload
        :param file_path: A file path to upload from
        :param name: A file name for uploading
        :param data: The file content to upload
        :return: The path of the uploaded file on the server

def upload(self, file_obj=None, file_path=None, name=None, data=None):
        """
        Upload an image and return its path on the server.
        Either `file_obj` or `file_path` or `name` and `data` has to be specified.

        :param file_obj: A file object to upload
        :param file_path: A file path to upload from
        :param name: A file name for uploading
        :param data: The file content to upload
        :return: The path of the uploaded file on the server
        """

        close = False

        if file_obj:
            file_name, content = os.path.basename(file_obj.name), file_obj

        elif file_path:
            file_name, content = os.path.basename(file_path), open(file_path, 'rb')
            close = True

        elif name and data:
            file_name, content = name, data

        else:
            raise GhostException(
                400,
                'Either `file_obj` or `file_path` or '
                '`name` and `data` needs to be specified'
            )

        try:
            content_type, _ = mimetypes.guess_type(file_name)

            file_arg = (file_name, content, content_type)

            response = self.execute_post('uploads/', files={'uploadimage': file_arg})

            return response

        finally:
            if close:
                content.close()