How to scan and upload php?

Asked By 50 points N/A Posted on -
qa-featured

Hi,

I just want to know if how to scan and upload PHP? There are some codes that needs to be scanned and uploaded but I don’t know how for much security purposes as well. I know there is a way to do this stuff, I need a step by step procedure on how to perform this. Can you help me guys?

SHARE
Answered By 0 points N/A #183471

How to scan and upload php?

qa-featured

Hi Christine, your question is a bit tricky but I think I can solve it for you.

What you need to do in this case is to create the directory; /var/www /uploads and make it writable to the apache user

Then create the file /var/www/upload.php

Create another file vi/var/www/upload.php

 <?php

$upload_dir='/var/www/uploads';

if($_POST){
$error = '';
//print_r($_FILES);
if($_FILES['file']['size'] == 0 || !is_file($_FILES['file']['tmp_name'])){
$error .= 'Please select a file for upload!';
} else {
cl_setlimits(5, 1000, 200, 0, 10485760);
if($malware = cl_scanfile($_FILES['file']['tmp_name'])) $error .= 'We have Malware: '.$malware.'<br>ClamAV version: '.clam_get_version();
}
if($error == ''){
rename($_FILES['file']['tmp_name'], $upload_dir.$_FILES['file']['name']);
}
}
?>
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
< html>
< head>
< title>File-Upload</title>
< meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
< /head>

 

I hope this helps

Thanks

Related Questions