public function createObject( $file, $parentNodeId, $name = '' )
    {
        $result = array();
        $parentNode = eZContentObjectTreeNode::fetch( $parentNodeId );
        if ( !$parentNode instanceof eZContentObjectTreeNode )
        {
            throw new InvalidArgumentException(
                ezpI18n::tr(
                    'extension/ezjscore/ajaxuploader', 'Location not found.'
                )
            );
        }

        $upload = new eZContentUpload();
        $r = $upload->handleLocalFile(
            $result, $file, $parentNodeId, null, $name,
            $this->attribute->attribute( 'language_code' )
        );
        if ( !$r || !$result['contentobject'] instanceof eZContentObject )
        {
            throw new RuntimeException(
                ezpI18n::tr(
                    'extension/ezjscore/ajaxuploader',
                    'Unable to create the content object to add to the relation: %detail',
                    null, array( '%detail' => $result['errors'][0]['description'] )
                )
            );
        }
        return $result['contentobject'];
    }