File "api.php"
Full Path: /home/analogde/www/antivirus/CURL/api.php
File size: 884 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
$status = 0; $msg = "";
if(isset($_FILES['file']['name'])){
// file name
$filename = $_FILES['file']['name'];
// Location
$location = ''.$filename;
// file extension
$file_extension = pathinfo($location, PATHINFO_EXTENSION);
$file_extension = strtolower($file_extension);
// Valid extensions
$valid_ext = array("pdf","doc","docx","jpg","png","jpeg");
$status = 0;
//if(in_array($file_extension,$valid_ext))
//{
// Upload file
if(move_uploaded_file($_FILES['file']['tmp_name'],$location))
{
$status = 1;
$msg = "Upload successfully";
}
//}
//else{
// $status = 0;
// $msg = "Invalid file extension";
//}
}
$response = array(
'status' => $status,
'msg' => $msg,
'num1' => $_POST['num1']
);
echo json_encode($response);
die;
?>