Yeah, maybe add a mimetype field to the attachment model, to allow this?