使用php作为图像将画布绘图上传到mysql数据库

时间:2017-11-18 15:08:56

标签: php

嗨伙计们。我想从画布中取一个绘图,而不是将其保存为像https://github.com/eligrey/FileSaver.js这样的图像。我想使用php将其上传到我的本地服务器mysql。

请帮助

<?php 

$conn = new mysqli("localhost","root","","userdetails");

$results = $conn->query("SELECT * FROM userInfo"); 

while($row = $results->fetch_assoc()){

     echo "Name :".$row['uname'].
          "<br/>Surname : ".$row['surname'].
          "<br/> Image : <img width='200' height='100' src='images/".$row['userImage']."' />"; 
 }

 @$uname = $_POST['uname'];
 @$surname = $_POST['surname'];
 @$image = $_POST['img']; 

if(isset($uname)){ 

    $conn->query("INSERT INTO userInfo values('','$uname','$surname','$image')");
    move_uploaded_file($image, '../images/'.basename($image));

 }

?>

0 个答案:

没有答案