How to retrive a real file system path for ezbinaryfile?

Author Message

Daniele Nocentini

Wednesday 06 February 2008 3:43:50 am

I need to retrive a path of the file system of an ezbinaryfile stored in ez from admin interface because I need to read this file from another php application written in a extension.

Antica Bottega Digitale srl
http://www.abd.it

Piotrek Karaƛ

Wednesday 06 February 2008 1:20:52 pm

Not sure if that's what you need, but what you get in the templates with:

{$node.data_map.file.content.filepath}

where $node contains an object with 'file' attribute of ezbinaryfile type, I found in the PHP with:

$contentObjectID = 158;
$fileAttributeIdentifier  = 'file';

$fileContentObject = eZContentObject::fetch( $contentObjectID );
$fileContentObject->fetchDataMap();
$fileAttributeObject = $fileContentObject->DataMap[$fileContentObject->CurrentVersion][$fileContentObject->CurrentLanguage][$fileAttributeIdentifier];
$fileAttributeObject->content();
$fileObject = $fileAttributeObject->Content;
$filePath = $fileObject->filePath();

If there's a better/quicker method - I'd be grateful for comments.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Daniele Nocentini

Thursday 07 February 2008 1:15:30 am

Thanks Piotrek, this is the exact code that I need.

{$node.data_map.file.content.filepath}

Antica Bottega Digitale srl
http://www.abd.it

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.