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.

eZ debug

Timing: Jan 18 2025 19:36:42
Script start
Timing: Jan 18 2025 19:36:42
Module start 'layout'
Timing: Jan 18 2025 19:36:42
Module start 'content'
Timing: Jan 18 2025 19:36:43
Module end 'content'
Timing: Jan 18 2025 19:36:43
Script end

Main resources:

Total runtime1.0822 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 589.5859152.6563
Module start 'layout' 0.00720.0031 742.242239.5078
Module start 'content' 0.01031.0701 781.7500540.6875
Module end 'content' 1.08040.0017 1,322.437512.0938
Script end 1.0821  1,334.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3225160.0002
Check MTime0.00140.1295160.0001
Mysql Total
Database connection0.00090.083310.0009
Mysqli_queries1.035295.6563570.0182
Looping result0.00050.0420550.0000
Template Total1.048696.920.5243
Template load0.00180.170520.0009
Template processing1.046896.728420.5234
Template load and register function0.00010.010410.0001
states
state_id_array0.00130.116910.0013
state_identifier_array0.00230.208120.0011
Override
Cache load0.00150.1382160.0001
Sytem overhead
Fetch class attribute can translate value0.00060.057120.0003
Fetch class attribute name0.00190.172850.0004
XML
Image XML parsing0.00100.089420.0005
class_abstraction
Instantiating content class attribute0.00000.001160.0000
General
dbfile0.00110.1056230.0000
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs