Answers for "determine the file types php upload"

PHP
9

php get filetype

<?php
echo filetype('/etc/passwd');  // file
echo filetype('/etc/');        // dir
?>
Posted by: Guest on February-03-2021
0

check what kind of file was uploaded php

$allowed = array('gif', 'png', 'jpg');
$filename = $_FILES['video_file']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if (!in_array($ext, $allowed)) {
    echo 'error';
}
Posted by: Guest on September-06-2021

Browse Popular Code Answers by Language