khhalid Posted April 26, 2010 Share Posted April 26, 2010 Hi Guys, I am trying to do an anti virus scan on the files I am uploading in PHP application and return virus found or not. if found then delete the file else load scanned file into "Scanned" folder. I am trying exec() function but not sure how to pass data file path to exec() function. I am using: <?php $tmp = exec("C:\Program Files\McAfee\VirusScan Enterprise\scan32.exe C:\48 SchemeTemplate.xls", $results); echo "Result: " . $results; ?> Can someone please help me. Many thanks for your time, ND Link to comment https://forums.phpfreaks.com/topic/199756-antivirus-scan-during-uploading-a-file/ Share on other sites More sharing options...
de.monkeyz Posted April 26, 2010 Share Posted April 26, 2010 I've never used McAfee on the command line, but if you look it up. I'm pretty sure you need to pass in the file name of what you're scanning, and surrounded in quotes if it contains spaces in the directory/filename. Also, are you aware if scan32.exe will produce any output? Link to comment https://forums.phpfreaks.com/topic/199756-antivirus-scan-during-uploading-a-file/#findComment-1048454 Share on other sites More sharing options...
khhalid Posted April 26, 2010 Author Share Posted April 26, 2010 csscan.exe is thecommand line application. I have ran in cmd and the summary section is what I am after (see attachment). Here are the codes I am using: <?php echo "start scanning..."; $return = array(); $tmp = exec("C:\Program Files\McAfee\VirusScan Enterprise\csscan.exe /c C:\48SchemeTemplate.xls", $return); foreach( $return as $line ) { echo $line,"\n\n"; } echo "scanning done."; ?> [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/199756-antivirus-scan-during-uploading-a-file/#findComment-1048618 Share on other sites More sharing options...
de.monkeyz Posted April 26, 2010 Share Posted April 26, 2010 Ah, I can't believe I didn't notice! In your exec. You have backslashes, these need to be escaped like so: <?php echo "start scanning..."; $return = array(); $tmp = exec("C:\\Program Files\\McAfee\\VirusScan Enterprise\\csscan.exe /c C:\\48SchemeTemplate.xls", $return); // Double backslash is needed to escape them foreach( $return as $line ) { echo $line,"\n\n"; } echo "scanning done."; ?> Link to comment https://forums.phpfreaks.com/topic/199756-antivirus-scan-during-uploading-a-file/#findComment-1048619 Share on other sites More sharing options...
khhalid Posted April 27, 2010 Author Share Posted April 27, 2010 sorry no joy, this is displaying my messages but nothing else [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/199756-antivirus-scan-during-uploading-a-file/#findComment-1049157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.