Jump to content

PHP automatically scan files for viruses?


random1

Recommended Posts

I have a site that holds a lot of user-updated content (including PDFs) that I want to automatically scan for viruses upon file upload or download.

 

An example of this would be Hotmail's email scanner that checks before you download.

 

How can I scan files when the user requests a download or performs an upload?

You have to define what is a "virus" in the files content in some sort of array or database system and then using file or file_get_contents() explore its content for malicious code and then from there approve or deny the file upload.

 

Its a large task for someone who doesn't know to start and I'd suggest its over kill for what you are doing if you have a properly setup .htaccess and chmods

Hmmm, shouldn't need to use anything custom really.

 

I found:

 

if (system("clamscan uploadedfile.rar"))

{

echo "File clean.";

}

else

{

echo "File infected.";

}

 

I don't know if I have 'clamscan' on my server but I'll give a whirl...

 

Anyone have any info for anything better?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.