IsValidWHFSName (open)

Check if a filename is acceptable

Syntax

LOADLIB "mod::system/lib/whfs.whlib";

BOOLEAN FUNCTION IsValidWHFSName(STRING filename, BOOLEAN allowslashes)

Parameters

STRING filename

Name of the file or path to check

BOOLEAN allowslashes

True if we should accept slashes in the filename (useful to check paths)

Return value

BOOLEAN

True if the names was acceptable

Description

Analyzes the filename and returns whether it is acceptable for use in WebHare. File and folder names not following these criteria cannot be published

Examples

//Returns TRUE, because no illegal characters are used
BOOLEAN ok1 := IsValidWHFSName ("document.doc",TRUE);

// Returns TRUE, because no illegal characters are used
BOOLEAN ok2:= IsValidWHFSName ("/folder/subfolder/document.doc",TRUE);

// Returns FALSE, because illegal slashes were used
BOOLEAN ok3 := IsValidWHFSName ("/folder/subfolder/document.doc",FALSE);