Fixed another error. It should be $file here, instead of $filename