
david at kineticode
Oct 20, 2009, 9:08 AM
Post #2 of 5
(622 views)
Permalink
|
On Oct 20, 2009, at 6:04 AM, Zdravko Balorda wrote: > I'd like to add a list of related media other than images. > pdf, doc and things that users may have attached to a story. > I wonder how can I check mime type of a media, file size, etc. At this time, related media elements do not have a constraint on the type of file that can be uploaded. The best you can do is check the media type in your templates and throw an exception on preview, something like this: unless ($image) { $burner->throw_error( 'There is no image associated! Associate an image or delete this related_media item' ) if $burner->get_mode == PREVIEW_MODE; return; } # This template only handles images. unless ($image->get_media_type->get_name =~ /^image\b/ ) { $burner->throw_error( 'This is not an image! You should only upload an image.' ) if $burner->get_mode == PREVIEW_MODE; return; } Best, David
|