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 Quote Link to comment 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? Quote Link to comment 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] Quote Link to comment 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."; ?> Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.