The signature image path cannot be saved to the database
P粉388945432
P粉388945432 2024-02-17 12:52:43
0
1
293

I use https://laratutorials.com/signature-pad-php-mysql-jquery/ to create the signature pad. The problem is that when I click submit, the signature image path is not saved to the database.

This is the code of upload.php

<?php
include_once '../db_connect.php';

$folderPath = "upload/";

$image_parts = explode(";base64,", $_POST['signed']);
    
$image_type_aux = explode("image/", $image_parts[0]);
  
$image_type = $image_type_aux[1];
  
$image_base64 = base64_decode($image_parts[1]);
  
$file = $folderPath . uniqid() . '.'.$image_type;
$sql="INSERT INTO works (sign) VALUES ('$file') WHERE id=1";
mysqli_query($con,$sql);
  
file_put_contents($file, $image_base64);
echo "Signature Uploaded Successfully.";
?>

Can anyone help?

P粉388945432
P粉388945432

reply all(1)
P粉402806175

The sign field in mysql database changes varchar to Text fieldcan be stored in the database

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!