PHP is_uploaded_file()Functions


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

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

If the file was uploaded via HTTP POST, the function returns TRUE.

Syntax

is_uploaded_file(file)

Parameter Description
file Required. Specifies the file to check.


Tips and Notes

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


Examples

<?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 will output:

test.txt is not uploaded via HTTP POST


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions