Advertisement
Virajsinh

file upload validation server side check extension in php

Dec 15th, 2021
1,411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.18 KB | None | 0 0
  1. $allowed = array('gif', 'png', 'jpg');
  2. $filename = $_FILES['video_file']['name'];
  3. $ext = pathinfo($filename, PATHINFO_EXTENSION);
  4. if (!in_array($ext, $allowed)) {
  5.     echo 'error';
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement