| Current Path : /home2/wtmwscom/public_html/admin/ |
| Current File : /home2/wtmwscom/public_html/admin/kyc_add_model.php |
<?php
session_start();
include('../connection.php');
include '../function_lib.php';
include './imageresize.php';
if(!isset($_POST['submit'])){
redirect("./kyc_doc_report.php");
die;
}
$uid = $_POST['uid'];
$doc_type = $_POST['doc_type'];
$update_id = $_POST['update_id'];
if(!empty($doc_type)) {
if($update_id !=0) {
$kyc_row_old = mysqli_fetch_object(mysqli_query($connection, "SELECT `id`, `uid`, `doc_type`, `file_name`,`file_path`, `create_date`, `is_delete` FROM `kyc_doc` WHERE id='$update_id'"));
mysqli_query($connection, "UPDATE `kyc_doc` SET is_delete='1' WHERE id='$update_id'");
unlink("../static/backend/user-resource/uploads/kyc_doc/".$kyc_row_old->file_name);
}
$smallImage ="";
if (!empty($_FILES['receipt']) && isset($_FILES['receipt']['name']) && array_search($_FILES['receipt']['type'], array("image/gif", "image/jpeg", "image/png", "image/jpg")) !== FALSE) {
$resize = new resizeImage();
// upload image in three dimesions
//$largePath = "uploads/news/large/";
//$largeImage = $resize->do_resize(500,400 ,$_FILES['receipt'],$largePath,0,"large");
$smallPath = "../static/backend/user-resource/uploads/kyc_doc/";
$smallImage = $resize->do_resize(800, 500, $_FILES['receipt'], $smallPath, 0, "thumb", 90);
}
$sql = "INSERT INTO `kyc_doc` (`uid`, `doc_type`, `file_name`,`file_path`, `create_date`, `is_delete`) VALUES
('".$uid ."', '".$doc_type."','".$smallImage."','../static/backend/user-resource/uploads/kyc_doc/','".date('Y-m-d H:i:s')."','0')";
$is_insert = mysqli_query($connection, $sql);
//echo $sql; die;
if($is_insert){
setMessage('KYC doc uploaded successfully.', 'alert-success');
} else {
setMessage('Something went wrong', 'alert-error');
}
}
redirect("./kyc_doc_report.php");
?>