Extract file validation method
Merge pull request #5818 from lucasmichot/4.2-request-isvalidfile

[4.2] Request : extract file validation method