PHP is_uploaded_file() 函數(shù)
PHP is_uploaded_file() 函數(shù)

定義和用法
is_uploaded_file() 函數(shù)檢查指定的文件是否是通過 HTTP POST 上傳的。
如果文件是通過 HTTP POST 上傳的,該函數(shù)返回 TRUE。
語法
is_uploaded_file(file)
參數(shù) | 描述 |
---|---|
file | 必需。規(guī)定要檢查的文件。 |
提示和注釋
注釋:該函數(shù)的結(jié)果會(huì)被緩存。請使用 clearstatcache() 來清除緩存。
實(shí)例
<?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");
}
?>
$file = "test.txt";
if(is_uploaded_file($file))
{
echo ("$file is uploaded via HTTP POST");
}
else
{
echo ("$file is not uploaded via HTTP POST");
}
?>
上面的代碼將輸出:
test.txt is not uploaded via HTTP POST

相關(guān)文章
- PHP 教程
- PHP echo 和 print 語句
- PHP 字符串
- PHP 數(shù)組排序
- PHP For 循環(huán)
- PHP 函數(shù)
- PHP 面向?qū)ο?/a>
- PHP 包含文件 include 和 require 語句
- PHP 文件上傳
- PHP 錯(cuò)誤處理
- PHP array_diff_ukey() 函數(shù)
- PHP array_replace_recursive() 函數(shù)
- PHP array_uintersect_uassoc() 函數(shù)
- PHP array_values() 函數(shù)
- PHP natcasesort() 函數(shù)
- PHP sort() 函數(shù)
- PHP 5 Directory 函數(shù)
- PHP Error 和 Logging 函數(shù)
- PHP HTTP 函數(shù)
- PHP PDO