THE WORLD'S LARGEST WEB DEVELOPER SITE

PHP is_uploaded_file() Function


❮ Complete PHP Filesystem Reference

Definition and Usage

The is_uploaded_file() function checks whether the specified file is uploaded via HTTP POST.

This function returns TRUE if the file is uploaded via HTTP POST.

Syntax

is_uploaded_file(file)

Parameter Description
file Required. Specifies the file to check

Tips and Notes

Note: The result of this function are cached. Use clearstatcache() to clear the cache.


Example

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

The output of the code above could be:

test.txt is not uploaded via HTTP POST

❮ Complete PHP Filesystem Reference