Forums / Developer / Set mime type of binary files programaticly
Dominik Pich
Monday 03 May 2004 7:03:38 am
How can I set the mime type of binary files programaticly?Thanks
Jan Borsodi
Monday 10 May 2004 11:53:42 pm
Do you mean the binary file datatype?Are you doing this in an import or in another setting?
-- Amos Documentation: http://ez.no/ez_publish/documentation FAQ: http://ez.no/ez_publish/documentation/faq
Tuesday 11 May 2004 12:47:20 am
I want to do this during import of a class with a binary file as attribute.I uploaded a pdf to go with the class and need to set its mime type to 'application/pdf'.
Wednesday 12 May 2004 4:37:04 am
Try something like this:
$binaryfile =& $attribute->content(); if ( is_object( $binaryFile ) ) { $binaryFile->setAttribute( 'mime_type', 'application/pdf' ); $binaryFile->store(); }
This assumes that <i>$attribute</i> is an eZContentObjectAttribute.