• PHP Video Tutorials

PHP - Function is_uploaded_file()



The is_uploaded_file() function can check whether the specified file is uploaded via HTTP POST. This function can return true if the file is uploaded via HTTP POST.

Syntax

bool is_uploaded_file ( string $filename )

This function can return true if the file named by filename has uploaded via HTTP POST. This sort of check especially useful if there is any chance that anything done with uploaded files can reveal their contents to the user or even to other users on the same system.

Example

<?php
   $file = "/PhpProject/simple.txt";
   if(is_uploaded_file($file)) {
      echo ("$file is uploaded via HTTP POST");
   } else {
       echo ("$file is not uploaded via HTTP POST");
   }
?>

Output

/PhpProject/simple.txt is not uploaded via HTTP POST
php_function_reference.htm
Advertisements