Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. // Check if image file is a actual image or fake image
  2. if(isset($_POST["submit"])) {
  3. $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  4. if($check !== false) {
  5. echo "File is an image - " . $check["mime"] . ".";
  6. $uploadOk = 1;
  7. } else {
  8. echo "File is not an image.";
  9. $uploadOk = 0;
  10. }
  11. }
  12.  
  13.  
  14. // Allow certain file formats
  15. if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
  16. && $imageFileType != "gif" ) {
  17. echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
  18. $uploadOk = 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement