Friday, June 5

Check uploaded file is actually an image using PHP.


<?php
    if (@getimagesize($_FILES["file"]["tmp_name"]) !== false) {
        $destination = "uploads/" . $_FILES["file"]["name"];
        move_uploaded_file($_FILES["file"]["tmp_name"], $destination);
    }
?>

No comments:

Post a Comment