Forums / Developer / ezBinaryfile filepath
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 [email protected] http://www.facileit.com
Thursday 10 May 2007 2:47:29 am
Up !
It's a dead or life situation for me .. ^^ So any ideas ?
Thx.
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
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...
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 ^^
Xavier Dutoit
Thursday 10 May 2007 9:18:49 am
Hi,
What's the goal of changing the filepath ?
X+
http://www.sydesy.com
Monday 14 May 2007 1:21:16 am
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.