Hook into a virus scanning step after upload on postback. This sample simulates a scan
and rejects filenames containing virus or eicar, while copying
clean files into App_Data/ScannedClean.
Drag & drop files here, or paste from clipboard
<%-- 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.