ScanFile function

Syntax

ScanFile(filepath, path_type)

Description

Use the ScanFile function to scan a file on the application server. This function reads the file and sends the data to the virus scan engine.

Parameters

Parameter Description

filepath

Specify the path of the file on the local system.

path_type

Specify whether the file path is absolute or relative. This is an optional parameter.

Valid values:

  • %FilePath_Relative

  • %FilePath_Absolute

The default value is %FilePath_Absolute.

Returns

An integer indicating the status of the file: 0 for clean file; non-zero value for infected or other statuses.

You can check for numeric or constant value.

Numeric Value Constant Value Description

9

%Attachment_FileNotFound

Cannot locate file.

13

%Attachment_ViolationFound

File violation detected by virus scan engine.

14

%Attachment_VirusScanError

Virus scan engine error.

15

%Attachment_VirusConfigError

Virus scan engine configuration error.

16

%Attachment_VirusConnectError

Virus scan engine connection error.

24

%Virusscan_Disabled

Virus scan is not enabled.

Example

&nRetcode= ScanFile("C:\Inline\example.pdf");

/*Following example uses relative path*/
&nRetcode= ScanFile("docs\example_scan.pdf",%FilePath_Relative);