In a form I am using croppie plugin to crop an image and uploaded it to db in base 64 methods. but the problem is I wanted to update the form if the file is not empty. ***ctimeshow and ctime are passing through ajax
<div id="store_image"></div>
<div style="height:172px;width:154px;" id="img_div" >
<?php if(!empty($row['image_reference_id'])){
$data1=mysqli_query($con,"SELECT * FROM `photo_table` WHERE image_unique_id = '".$row['image_reference_id']."'");
$row1=mysqli_fetch_assoc($data1);
?>
<img src="data:image/jpg;base64, <?php echo base64_encode($row1['images']);?>" />
<?php }
else{?>
<img src="../images/<?php echo $row['app_image'] ?>" height="100px" >
<?php } ?>
</div>
<br/>
<label class="col-md-12">Upload An Image </label>
<div class="col-md-12">
<!-- <input style="width: 100%;" type="file" name="app_image" id="file" class="btn btn-warning" /> -->
<input type="file" style="width: 100%;" name="app_image" id="file" class="btn btn-warning" accept="image/*" />
</div>
<input type="text" name="ctimestamp" id="ctimestamp" value="<?php echo time(); ?>" >
<input type="text" name="ctimestampshow" id="ctimestampshow" value="<?php echo $row['image_reference_id']; ?>" >
</div>
#action page
if(!empty($_POST['image'])){
if(!empty($row['image_reference_id'])){
$qry = "UPDATE `register` SET `app_id`='$edit_id', `image_reference_id`='$ctimeshow'WHERE `app_id`='$id'";
//echo $qry;
}
else
{
$qry = "UPDATE `register` SET `app_id`='$edit_id', `image_reference_id`='$ctime' WHERE `app_id`='$id'";
}
}
Aucun commentaire:
Enregistrer un commentaire