Advertisement
Guest User

Untitled

a guest
May 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. include 'connection.php';
  4. $image = $_FILES['image']['name'];
  5. $thumb = $_FILES['thumb']['name'];
  6. $prop_id = $_POST['item'];
  7.  
  8. $resize = new Imagick($thumb);
  9. $resize->adaptiveResizeImage(150,150);
  10.  
  11. //echo $image;
  12.  
  13. $imagePath='uploads/'.$image;
  14. move_uploaded_file($_FILES['image']['tmp_name'],$imagePath);
  15.  
  16. $thumbPath='uploads/'.$resize;
  17. move_uploaded_file($_FILES['thumb']['tmp_name'],$thumbPath);
  18.  
  19. // Check Queries if Duplicate
  20. $res = $connect->query("SELECT * FROM properties WHERE category_id = '".$prop_id."' AND image = '".$image."' ");
  21. $check=mysqli_num_rows($res);
  22.  
  23. if($check>0) :
  24. else :
  25. // Add if no Data duplicate
  26. $connect->query("INSERT INTO properties (category_id,image,thumb) VALUES ('".$prop_id."','".$image."','".$thumb."') ");
  27. endif;
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement