Change var name: $fileName was confusing with argument $filename.