PHP Tutorial - PHP is_uploaded_file() Function






Definition

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

Syntax

PHP is_uploaded_file() Function has the following syntax.

is_uploaded_file(file)

Parameter

ParameterIs RequiredDescription
fileRequired.File to check

Return

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

Note

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





Example

whether the specified file is uploaded via HTTP POST


<?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 code above generates the following result.