Advertisement
Guest User

Untitled

a guest
Jan 4th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <form method="post" enctype="multipart/form-data">
  2. <input type="file" name="image"/>
  3. <input type="submit" name="upload" value="Uploaded"/>
  4. </form>
  5. <?php
  6.     session_start();
  7.     $host="localhost";
  8.     $username = "root";
  9.     $password = "";
  10.     $dbname = "image";
  11.     $conn = new mysqli($host, $username, $password, $dbname);
  12.     if(isset($_POST['upload'])){
  13.         $image=addcslashes($_FILES['image']['tmp_name']);
  14.         $name=addcslashes($_FILES['image']['name']);
  15.         $image=file_get_contents($image);
  16.         $image=base64_encode($image);
  17.         mysqli_query("inset into image(dbid,image) values('','$image')");
  18.         echo "image upload";
  19.     }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement