Menu Home

is_uploaded_file

osbo.com | PHP | Functions | is_uploaded_file

Tells whether the file was uploaded via HTTP POST

Syntax

is_uploaded_file ( string $filename ) : bool

Parameters

filename

The filename being checked.

Return

Returns TRUE on success or FALSE on failure.

Examples

<?

$filename = $_FILES['userfile']['tmp_name'];

if (is_uploaded_file($filename)) {
    echo "uploaded via HTTP POST\n";
    readfile($filename);
} else {
    echo "not uploaded via HTTP POST\n";
}

?>
not uploaded via HTTP POST

PHP