File event handler