Author Topic

Philippe VINCENT-ROYOL

Thursday 17 April 2008 2:32:46 am

Comment49381

Now i continue ^^

The last step is to add more file. I've try to use eZContentFunctions::createAndPublishObject( $params ); to add more file but don't find a solution.

so i've add this :

$object = eZContentFunctions::createAndPublishObject( $params );
		
if($fichier2 != "")
{
	include_once("kernel/classes/datatypes/ezbinaryfile/ezbinaryfile.php");
	include_once("lib/ezutils/classes/ezmimetype.php");
	include_once("lib/ezutils/classes/ezdir.php");
				
	$contentObjectAttributes =& $object->contentObjectAttributes();
			
	$attributeValue = $rows[$i]["FIC2_NOM"];
	$contentObjectAttributes[1]->setAttribute('binary_file', $attributeValue);
	$contentObjectAttributes[1]->store();
				
	$contentObjectAttribute =& $contentObjectAttributes[1];
			
	$contentObjectAttributeID = $contentObjectAttribute->attribute("id");
	$version = $contentObjectAttribute->attribute("version");
				
	$file =& eZBinaryFile::create($contentObjectAttributeID, $version);
				
	$file->setAttribute("contentobject_attribute_id", $contentObjectAttributeID);
	$file->setAttribute("version", $version);
	$file->setAttribute("filename", $rows[$i]["FIC2_NOM"]);
	$file->setAttribute("original_filename", $rows[$i]["FIC2_NOM"]);
				
	$mimeObj = new eZMimeType();
	$mime = $mimeObj->mimeTypeFor( false, $rows[$i]["FIC2_NOM"]);
			
	$file->setAttribute("mime_type", $mime);
	$file->store();
				
	$sys =& eZSys::instance();
	$storage_dir = $sys->storageDirectory();
				
	list($subdir, $extension) = split("/",$mime);
	$file_dir = $storage_dir.'/'."original/".$subdir;
	if(!file_exists($file_dir))
	{
		eZDir::mkdir($file_dir,0777,true);
	}
	$source_file = $storage_dir."/temp/".$rows[$i]["FIC2_NOM"];
	$target_file = $storage_dir."/original/".$subdir."/".$rows[$i]["FIC2_NOM"];
	copy($source_file,$target_file);
				
}

So , Exponential have insert lines on ezbinaryfile table but when i want to see on back office the node.. it show only the first file :/

Thanks in advance,
Philippe

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe