Fix a bug that crashes when uploading a file in newer versions of php
type check