I an trying to add virus scanning to the file upload section of our portal using uvscan. The virus scanning is working properly using a system call , but I am having problems with formatting the output. I need to check the return value and if it is not a 0, I want to create a custom message. The problem is, when using system the output of the call is flushed to the browser before I can write the custom message so I have the uvscan message and then my custom message.

This is my code.

$uvscan_cmd = "/usr/local/bin/uvscan " . $_FILES['file']['tmp_name'];
$output = system("$uvscan_cmd" , $retval);


       if ( $retval != 0) {
               print "<br>A virus was found in your file <br>$output<br>";
          exit;
       }

This results in the following sent to the browser.

/var/tmp/phpBFaaIa Found the W32/[EMAIL PROTECTED] virus !!!

A virus was found in your file.
Found the W32/[EMAIL PROTECTED] virus !!!


How can get rid of the first line and still have data $output? I tried adding a 2 > &1 to the system call and tried redirecting the output to /dev/null. This got rid of the first line but also resulted in $output not having an output.


--
Ron Clark
System Administrator/Web Coordinator
Armstrong Atlantic State University

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to