Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.117.151.198
Current Path : /var/www/html/phdadm/ |
| Current File : /var/www/html/phdadm/photoupload.php |
<?php
$dbhost = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$dbuser = "admin";
$dbpass = "T0g3th3r@all";
$db = "logisys3_nub";
$conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n". $conn -> error);
if ( 0 < $_FILES['file']['error'] ) {
echo 'Error: ' . $_FILES['file']['error'] . '<br>';
}
else {
$x = $_FILES['file'];
// var_dump($_FILES['file']);
// die();
$f_file=explode(".",$x["name"]);
$new_filename=$f_file[0].".".$f_file[1];
// var_dump($new_filename);
// die();
move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/'. $_FILES['file']['name']);
}
if($new_filename){
$arr['err_code'] = 0;
$arr['status'] = 'success';
$arr['uploadedfile']=$new_filename;
$arr['msg'] = 'Updated Successfully...!';
echo json_encode($arr);
return;
}else {
$arr['err_code'] = -1;
$arr['status'] = 'Failure';
$arr['msg'] = 'Failed To update';
echo json_encode($arr);
return;
}
?>
|