The primate brain codes perceived events in a distributed fashion, which raises the question of how the codes referring to the same event are related to each other. Recent findings suggest that they are integrated into 'object files', episodic bindings of object-related information. However, the problem of integrating distributed codes is not restricted to perception but applies to action planning and sensorimotor processing as well. Here I argue that the brain addresses these problems by creating multi-layered networks of bindings - 'event files' - that temporarily link codes of perceptual events, the current task context, and the actions performed therein. These bindings produce systematic but often surprising and counter-intuitive interactions between, and impairments in, perception and action planning.