I am trying to update of an blob image using base64_encode but when I pressed button Update its successfully update the text and image however the image is not properly display
HERE’S MY EDIT CODE:
if(isset($_POST['edit'])){
$updateitemName = $_POST['itemName'];
$updateitemDescription = $_POST['litemDescription'];
$updateitemPrice = $_POST['itemPrice'];
//when user upload image to update
if(isset($_FILES['itemIMG']['name'])){
$updateImage = $_FILES['itemIMG']['name'];
$updateimageTempLoc = $_FILES['itemIMG']['tmp_name'];
$pathIMG = "image/".base64_encode($updateImage);
move_uploaded_file($updateimageTempLoc,$pathIMG);
$sql = "UPDATE item SET ITEM_NAME = '$updateitemName',
ITEM_DESCRIPTION = '$updateitemDescription',
ITEM_IMG = '$updateImage',
ITEM_PRICE = '$updateitemPrice' WHERE ITEM_ID = $updateitemID";
$results=mysqli_query($conn,$sql);
if($results){
$messages = "Successfully updated Item";
echo "<script type='text/javascript'>alert('$messages');window.location.replace('item.php');</script>";
}else{
die(mysqli_error($conn));
}
//if the user update the text only not inlcude the image
}else{
$sql = "UPDATE item SET ITEM_NAME = '$updateitemName',
ITEM_DESCRIPTION = '$updateitemDescription',
ITEM_PRICE = '$updateitemPrice' WHERE ITEM_ID = $updateitemID";
$results=mysqli_query($conn,$sql);
if($results){
$messages = "Successfully updated Item";
echo "<script type='text/javascript'>alert('$messages');window.location.replace('myinventoryitem.php');</script>";
}else{
die(mysqli_error($conn));
}
}
}