Advertisement
Guest User

bantu aku

a guest
Oct 27th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.  
  3. require_once ('db.php');
  4.  
  5. if (isset($_POST['Submit'])) {
  6. // echo "";
  7. // }else{
  8. // $file=$_FILES['image']['tmp_name'];
  9. // $image = $_FILES["image"] ["name"];
  10. // $image_name= addslashes($_FILES['image']['name']);
  11. // $size = $_FILES["image"] ["size"];
  12. // $error = $_FILES["image"] ["error"];
  13. //
  14. // if ($error > 0){
  15. // die("Error uploading file! Code $error.");
  16. // }else{
  17. //  if($size > 10000000) //conditions for the file
  18. //  {
  19. //  die("Format is not allowed or file size is too big!");
  20. //  }
  21. //  
  22. // else
  23. //  {
  24. move_uploaded_file($_FILES["image"]["tmp_name"],"uploads/" . $_FILES["image"]["name"]);        
  25. $location=$_FILES["image"]["name"];
  26. $name=$_POST['name'];
  27. $deskripsi=$_POST['deskripsi'];
  28. $paket=$_POST['paket']
  29.  
  30. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  31. $sql = "INSERT INTO tbl_image (name, deskripsi, paket, image_location)
  32. VALUES ('$name', '$deskripsi', '$paket', '$location')";
  33.  
  34. $conn->exec($sql);
  35. echo "<script>alert('Successfully Added!!!'); window.location='index.php'</script>";
  36. // }
  37. }
  38. // }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement