is_uploaded_file
Determine whether the file is uploaded through HTTP POST
is_uploaded_file()
function determines whether the specified file is uploaded through 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"); } ?>
输出:
test.txt is not uploaded via HTTP POST
is_uploaded_file ( file )
parameter | describe |
---|---|
file | Required. Specify documents to be inspected. |
Return TRUE if the file given by the file is uploaded via HTTP POST.
This function can be used to ensure that malicious users cannot trick scripts into accessing files that are not accessible, such as /etc/passwd.
This kind of check is particularly important if the uploaded file may cause the content to be displayed to the user or other users of the system.