check both file and filename

README says to use filename property, but it only checks file property.
To maintain backwards compatibility it should check both.
Merge pull request #1 from cesarandreu/patch-1

check both file and filename