Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['pic_upload']))
  3. {
  4. require'db.php';
  5.  
  6. $imageName = mysqli_real_escape_string($conn,$_FILES["profilepic"]["name"]);
  7. $imageData = mysqli_real_escape_string($conn,file_get_contents($_FILES["profilepic"]["tmp_name"]));
  8.  
  9. $imageType = mysqli_real_escape_string($conn,$_FILES["profilepic"]["type"]);
  10.  
  11. if(substr($imageType,0,5) == "image")
  12.  
  13. {
  14. $sql= "INSERT INTO user (img_name,image) VALUES ('$imageName','$imageData') where username= '$x'";
  15. echo "img done";
  16. }
  17. else {
  18. echo " not upload";
  19. }
  20.  
  21. }
  22.  
  23. ?>
  24.  
  25. <form action="#" method="POST" enctype="multipart/form-data">
  26. <input type="file" name="profilepic"><br>
  27. <input type="submit" name="pic_upload"class="btn-1">
  28. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement