src/File.php
public function add($objectID, $filePath, $description = '') {
        $fileAsString = $this->encode($filePath);

        $cmdbObject = new CMDBObject($this->api);

        $fileObjectID = $cmdbObject->create(
            'C__OBJTYPE__FILE',
            $description
        );

        $cmdbCategory = new CMDBCategory($this->api);

        $cmdbCategory->create(
            $fileObjectID,
            'C__CATS__FILE_VERSIONS',
            [
                'file_content' => $fileAsString,
                'file_physical' => basename($filePath),
                'file_title' => $description,
                'version_description' => $description
            ]
        );

        $cmdbCategory->create(
            $objectID,
            'C__CATG__FILE',
            [
                'file' => $fileObjectID
            ]
        );

        return $this;
    }
public function add($objectID, $filePath, $description = '') {
        $fileAsString = $this->encode($filePath);

        $cmdbObject = new CMDBObject($this->api);

        $fileObjectID = $cmdbObject->create(
            'C__OBJTYPE__FILE',
            $description
        );

        $cmdbCategory = new CMDBCategory($this->api);

        $cmdbCategory->create(
            $fileObjectID,
            'C__CATS__FILE_VERSIONS',
            [
                'file_content' => $fileAsString,
                'file_physical' => basename($filePath),
                'file_title' => $description,
                'version_description' => $description
            ]
        );

        $cmdbCategory->create(
            $objectID,
            'C__CATG__FILE',
            [
                'file' => $fileObjectID
            ]
        );

        return $this;
    }
public function add ( $ objectID , $ filePath , $ description = '' ) { $ fileAsString = $ this -> encode ( $ filePath ) ; $ cmdbObject = new CMDBObject ( $ this -> api ) ; $ fileObjectID = $ cmdbObject -> create ( 'C__OBJTYPE__FILE' , $ description ) ; $ cmdbCategory = new CMDBCategory ( $ this -> api ) ; $ cmdbCategory -> create ( $ fileObjectID , 'C__CATS__FILE_VERSIONS' , [ 'file_content' => $ fileAsString , 'file_physical' => basename ( $ filePath ) , 'file_title' => $ description , 'version_description' => $ description ] ) ; $ cmdbCategory -> create ( $ objectID , 'C__CATG__FILE' , [ 'file' => $ fileObjectID ] ) ; return $ this ; }
Add a new file to a specific object. A new file object will be created and assigned to the specific object.

@param int $objectID Object identifier
@param string $filePath Path to file
@param string $description (Optional) description

@return self Returns itself

@throws Exception on error
Add a new file to a specific object . A new file object will be created and assigned to the specific object .