Whistik

Untitled

Jul 13th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. $target_dir = "uploads/";
  3. $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  4. $uploadOk = 1;
  5. $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  6. // Check if image file is a actual image or fake image
  7. if(isset($_POST["submit"])) {
  8. $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  9. if($check !== false) {
  10. echo "File is an image - " . $check["mime"] . ".";
  11. $uploadOk = 1;
  12. } else {
  13. echo "File is not an image.";
  14. $uploadOk = 0;
  15. }
  16. }
  17. ?>
Add Comment
Please, Sign In to add comment