Sitemap

Sunday, April 5, 2015

UCM: Validating file extension

1. Enter "IsDpSubmitErrorFatal=true" in the general configuration, and restart the server.
2. Create a global rule, with the activation conditions of "OnSubmit" for "Check In New" and "Check In Selected".
3. In the rule's "Side Effect" section, add the following code.

<$trace("#all", "#console")$>
<$strFileName=strReplace(primaryFile,".",",")$>
<$trace(strFileName, "#console")$>
<$exec rsMakeFromString("rsTempFile",strFileName,"ext")$>
<$exec rsSetRow("rsTempFile", rsTempFile.#numRows-1)$>

<$if strTrimWs(rsTempFile.ext) like "exe"$>
   <$abortToErrorPage("\n\nEXE files are not allowed.")$>
<$endif$>

Now using this way, we won't be able to restrict checking in exe files using DIS. For this, you have to change the idocScript code in the custom tab.

Before:
 ( (dpEvent like "OnSubmit") and
 (dpAction like "CheckinSel" or dpAction like "CheckinNew"))

After:
 ( (dpEvent like "OnSubmit" or dpEvent like "OnImport") and
 (dpAction like "CheckinSel" or dpAction like "CheckinNew" or dpAction like "NoAction"))

No comments:

Post a Comment