Virus Scan Integration

Virus Scan Integration

Hook into a virus scanning step server-side after each file lands. This sample simulates a scan and rejects filenames containing virus or eicar, while copying clean files into App_Data/ScannedClean. Swap the stub for a real call to ClamAV (clamscan), Windows Defender (MpCmdRun.exe -Scan), or any AV CLI and you have a production virus-scan pipeline.

A dedicated /scan endpoint is also bundled for async post-upload scans that don't block the response. Pair this with client-side AES-GCM encryption-at-rest for end-to-end confidentiality before bytes ever reach the scanner.

Drag & drop files here, or paste from clipboard
Clean
Rejected
<%-- ASPX markup --%>
<au:AjaxFileUpload ID="Uploader1" runat="server"
 AutoUpload="true"
 ShowProgress="true"
 OnFileUploaded="Uploader1_FileUploaded" />

<%-- Code-behind: virus scanning in FileUploaded event --%>
protected void Uploader1_FileUploaded(object sender,
 AjaxFileUploadEventArgs e)
{
 if (e.FileName.Contains("virus"))
 {
 new UploadService().DeleteFile(e.FileGuid);
 return;
 }

 new UploadService().CopyFile(
 e.FileGuid,
 Server.MapPath("~/App_Data/ScannedClean/" + e.FileName));
}

Tip: rename a test file to include virus or eicar to see the rejection branch in action.