Set mime type of binary files programaticly

Author Message

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

Dominik Pich

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'.

Jan Borsodi

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.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.