eZDataType is meant as base class for other datatypes.
I am not sure what you want to do, but trying to instantiate a datatype doesn't make much sense. The content needs to be stored in a attribute in a contentobject. Once you have the content object, the different datatypes will be instantiated for you
Well.... My first problem was to read a file content from an uploaded file and during all my investigations, I've found the classe eZDataType which seems to be ok to do the job for me.
But reading your answer I should be on a wrong way.
It depends on where you're handling uploaded files, but if you're in your own module I suggest you take a look at the eZHTTPFile class. You can find it in the lib/ezutils/classes dir.
If that's not what you're trying to do, please explain your problem in greater detail :-)
Your right, my problem is not well explain.
- The user, upload a file in the Back Office in a file object. For that, I've create a file object in the BO, in a specific folder. The user will use always the same object, so I'll have different version. This is a text file. - With a cron job I have to import in a specific database datas stored in the file. For that, I have to read my file content with a php script, and my trouble is to point that file.
But I don't know how to read my text file content. So I search in eZDataType classe without success. And I'm not sure that the eZHTTPFile class is the good one.
eZHTTPFile is indeed not what you need in your case. You are actually trying to access a file that is a part of a content object.
So first of all, you need to fetch the object in some way. Once you have it, you'll have an instance of the eZContentObject class. Objects of that class have a method called <i>dataMap</i>. That method returns an array with the following structure:
- key: identifier of the attribute as specified in the content class - value: instance of eZContentObjectAttribute
The class eZContentObjectAttribute actually (for the real data at least) wraps around the datatype. If you query the eZContentObjectAttribute instance for content(), you will get the content that has been stored by the corresponding datatype. That content can be a scalar value, an array or even an object of class. The latter is the case for attributes of the type file.
The datatype for files is called ezbinaryfile (kernel/classes/datatypes) and the content of that datatype returns an instance of the class eZBinaryFile.
That should get you on the road. I obviously left some things out, but the goal is that you actually learn something. So it's your task to connect the dots ;-)