Advertisement
adrianpascua

Untitled

Jun 2nd, 2016
114
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 '../session.php';
  4. require_once 'config.php';
  5.  
  6.  
  7. if (isset($_POST['submit'])) {
  8.  
  9. $imageName = $_FILES["image"]["name"];
  10. $imageData = file_get_contents($_FILES["image"]["tmp_name"]);
  11. $imageType = $_FILES["image"]["type"];
  12.  
  13. if (substr($imageType, 0,5) == "image") {
  14. $query = "UPDATE `crew_info` SET `image_name` = ?, `updated_photo` = ? WHERE `id` = ?";
  15. $stmt = mysqli_prepare($conn, $query);
  16. mysqli_stmt_bind_param($stmt, 'ssi', $imageName, $imageData, $_POST['id']);
  17. mysqli_stmt_execute($stmt);
  18. $id = $_POST['id'];
  19.  
  20. header("Location: ../admin/view_all_info.php?id=$id");
  21.  
  22. }
  23.  
  24. else {
  25.  
  26. echo "Image not Uploaded!";
  27.  
  28. }
  29.  
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement