$filename is one of the strings concantenated to create $storyfile and is in turn made up of various bits of data from the initial HTML form. From memory, I think I used it here to make sure that $filename was working out correctly.
Thanks for pointing it out.