Upload Excel file using PHP application

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
khhalid
Forum Newbie
Posts: 7
Joined: Tue Apr 20, 2010 4:45 pm

Upload Excel file using PHP application

Post by khhalid »

Hi Guys, I'm bit new to PHP and trying to build a PHP application with:
1. Select Excel file from any where in C drive and Upload into Loader folder functionality
2. While uploading, do McAfee scan to make sure the file is clean.

Any example would be very helpful.

Many thanks for your time.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Re: Upload Excel file using PHP application

Post by a94060 »

khhalid wrote:Hi Guys, I'm bit new to PHP and trying to build a PHP application with:
1. Select Excel file from any where in C drive and Upload into Loader folder functionality
2. While uploading, do McAfee scan to make sure the file is clean.

Any example would be very helpful.

Many thanks for your time.
For the first part read how to upload a file. The user should know be able to find the file. As for the virus scan, I doubt that would be needed because I am assuming that you would be splitting the file (using explode,etc) to find data that you need from it,etc. Unless you are executing it on excel, I don't think viruses should be a big concern. In the very worst case,if the server is a windows machine,it will catch it.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Upload Excel file using PHP application

Post by Jonah Bron »

Here's a tutorial on uploading.

http://www.w3schools.com/PHP/php_file_upload.asp

As a94060 said, if you're just parsing the file in PHP, there's no need to scan it. If you need to scan it for sure, you can call command line programs with shell_exec()

http://www.php.net/manual/en/function.shell-exec.php
khhalid
Forum Newbie
Posts: 7
Joined: Tue Apr 20, 2010 4:45 pm

Re: Upload Excel file using PHP application

Post by khhalid »

Thank you guys,
I am now able to upload files but scan bit still in the air.
I am uploading Excel file and scan it then move into "Scanned" folder.
Here are the codes I am using:
<?php
echo "start scanning" . "<br/>";
$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<br>\n";
}
echo "done."
?>
I want to read the output but when I run the php file with above codes, this displays my messages (i.e. 'stat scanning' and 'done.') and not reading the output from $return.
I use cmd line and enter 'csscan.exe -c C:\\48SchemeTemplate.xls' and the output return number of lines (see attachment).

Any idea what I am missing here?? :?
Many thanks for your time,
Attachments
scan.JPG
scan.JPG (69.42 KiB) Viewed 3726 times
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Upload Excel file using PHP application

Post by Jonah Bron »

Not sure. It seems like it should be giving the response. Try $return = shell_exec();
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Upload Excel file using PHP application

Post by Benjamin »

:arrow: Moved to Volunteer Work
khhalid
Forum Newbie
Posts: 7
Joined: Tue Apr 20, 2010 4:45 pm

Re: Upload Excel file using PHP application

Post by khhalid »

I am now using different utility from McAFee, Command Line Scanner, to return the output and that seem to working.

Thank you guys for your time.
Post Reply