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.217.26.8
Current Path : /kop/admin/ |
| Current File : //kop/admin/upload.php |
<?php
if ( 0 < $_FILES['file']['error'] ) {
echo 'Error: ' . $_FILES['file']['error'] . '<br>';
}
else {
$x = $_FILES['file'];
$f_file=explode(".",$x["name"]);
if($f_file[1] == 'pdf' || $f_file[1] == 'jpeg'){
$new_filename=$f_file[0].".".$f_file[1];
move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/'. $_FILES['file']['name']);
}else{
$arr['msg'] = 'only pdf and jpeg files are allowed..!';
echo json_encode($arr);
return;
}
}
if($new_filename){
$arr['err_code'] = 0;
$arr['status'] = 'success';
$arr['uploadedfile']='/uploads/'.$new_filename;
$arr['msg'] = 'Updated Successfully...!';
echo json_encode($arr);
}else {
$arr['err_code'] = -1;
$arr['status'] = 'Failure';
$arr['msg'] = 'Failed To update';
echo json_encode($arr);
return;
}
?>
|