[WFCORE-171] Validate the file is not an existing directory before setting the file on a file-handler.
Merge pull request #263 from jamezp/WFCORE-171-b

[WFCORE-171] Validate the file is not an existing directory