Author Topic

Kristof Coomans

Monday 22 January 2007 1:51:40 am

Comment47606

You can create an object and use the insertRegularFile function of the file attribute to fill it. It will use the datatype's implementation of the insertRegularFile function to store a file in the attribute. Of course only certain datatypes (ezimage, ezbinaryfile) implement this.

Another way is using eZContentUpload, which will create the right content class according to the file's mime type.

include_once( 'kernel/classes/ezcontentupload.php' );
$upload = new eZContentUpload();
    
$success = $upload->handleLocalFile( $result, $localFilePath, 'auto', false, $name );
print_r( $result );

Note that there are some unclosed bugs involved in both situations, but patches are attached: http://issues.ez.no/9312 and http://issues.ez.no/9736

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org