ezBinaryfile filepath

Author Message

Romain Dausset

Wednesday 09 May 2007 6:35:38 am

Hello all,

I would like to change the value of the 'filepath' attribute of an ezBinaryFile.

I can already get this attribute but it doesn't work when i try to change it.

Get filepath attribute of my file :

		$dataMap = $object->attribute( 'data_map' );
		$contentObject = $dataMap['file'];

		$file = $contentObject->attribute( 'content' );

		$filepath = $file->attribute( 'filepath' );

Change it : (don't work)

		$file->setAttribute( 'filepath', $newpath );	
		$file->store();

Any ideas ?

Thx,
Romain.

--
Romain Dausset

rdausset@facileit.com

http://www.facileit.com

Romain Dausset

Thursday 10 May 2007 2:47:29 am

Up !

It's a dead or life situation for me .. ^^ So any ideas ?

Thx.

--
Romain Dausset

rdausset@facileit.com

http://www.facileit.com

Frédéric DAVID

Thursday 10 May 2007 5:26:22 am

When you want to use the eZ publish API, some functions required the & to add a reference.

You can try :

$dataMap =& $object->dataMap();
$attributeFile = $dataMap['file'];

$file =& $attributeFile->content();
$file->setAttribute( 'filepath', $newpath ); 
$file->store();

I haven't test this code, but it can help you a little.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Romain Dausset

Thursday 10 May 2007 5:47:18 am

Thank you for your reply, I've test it and it's not the solution.

In fact, the ezbinaryfile seems to be a very particular datatype.

I found this post about it : http://ez.no/community/forum/developer/importing_pdf_files_storing_ezbinaryfile_types_using_php/re_importing_pdf_files_storing_ezbinaryfile__6

So now I'm trying to use the function insertRegularFile, just to change the filepath...

--
Romain Dausset

rdausset@facileit.com

http://www.facileit.com

Romain Dausset

Thursday 10 May 2007 6:32:10 am

Someone have ever used the function " insertRegularFile()" ?

Which is in : "kernel/classes/datatypes/ezmedia/ezmediatype.php"

I'm using it like that :

insertRegularFile(&$object, $objectVersion, $objectLanguage, &$objectAttribute, $filepath, &$result);

But I got a fatal error when i try to use it :
Fatal error: Call to undefined function: insertregularfile()

Thx for helping ^^

--
Romain Dausset

rdausset@facileit.com

http://www.facileit.com

Xavier Dutoit

Thursday 10 May 2007 9:18:49 am

Hi,

What's the goal of changing the filepath ?

X+

http://www.sydesy.com

Romain Dausset

Monday 14 May 2007 1:21:16 am

Hi,

The the goal is to keep the ez file system to manage file upload, and upload this files on a distant server.

But I've made a solution, creating my own file class to store file informations ( adress, size mimy type... ) and upload on my distant server.

++
Rom.

--
Romain Dausset

rdausset@facileit.com

http://www.facileit.com

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 10:37:52
Script start
Timing: Jan 18 2025 10:37:52
Module start 'layout'
Timing: Jan 18 2025 10:37:52
Module start 'content'
Timing: Jan 18 2025 10:37:53
Module end 'content'
Timing: Jan 18 2025 10:37:53
Script end

Main resources:

Total runtime0.7847 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.0078152.6094
Module start 'layout' 0.00530.0031 741.617239.4141
Module start 'content' 0.00850.7748 781.0313635.9063
Module end 'content' 0.78330.0014 1,416.937520.1875
Script end 0.7846  1,437.1250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4158160.0002
Check MTime0.00130.1681160.0001
Mysql Total
Database connection0.00080.105010.0008
Mysqli_queries0.700189.2223710.0099
Looping result0.00070.0908690.0000
Template Total0.755796.320.3779
Template load0.00200.253520.0010
Template processing0.753796.054520.3769
Template load and register function0.00010.013910.0001
states
state_id_array0.00150.188610.0015
state_identifier_array0.00130.170320.0007
Override
Cache load0.00170.2197520.0000
Sytem overhead
Fetch class attribute can translate value0.00120.150230.0004
Fetch class attribute name0.00230.2958100.0002
XML
Image XML parsing0.00640.814230.0021
class_abstraction
Instantiating content class attribute0.00000.0037140.0000
General
dbfile0.00560.7134280.0002
String conversion0.00000.001040.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
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 36
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs