PHP

RESTRICT UPLOAD FILE TYPE IN PHP

<form action="UP.PHP"             enctype="multipart/form-data">   <input type="file" name="up" required               accept=".jpg,.png,.gif"/>    <input type="submit" value="Upload"/> </form>

HTML FILE UPLOAD FORM

01

ALLOWED FILE TYPES $allow = ["jpg", "png", "gif"];   UPLOADED FILE TYPE $ext = strtolower(pathinfo($_FILES["up"]["name"], PATHINFO_EXTENSION));   SAVE UPLOADED FILE if (in_array($ext, $allow)) {   $src = $_FILES["up"]["tmp_name"];   $dest = $_FILES["up"]["name"];   move_uploaded_file($src, $dest); }

PHP UPLOAD HANDLER

02