The function of is_uploaded_file in php is to determine whether the uploaded file is successful.
The function of is_uploaded_file in php is to determine whether the uploaded file is successful.
Is_uploaded_file
("= 4.0.3, PHP 5" in PHP 4)
Is_uploaded_file-Indicates whether to upload the file through HTTP
Description
Boolean is_uploaded_file (string $ file name)
Returns TRUE if the file name is named as a post uploaded over HTTP. This is very useful to help ensure that malicious users are not trying to fool scripts to archive the work on which they should not work-for example, the/etc/passwd file.
Such a check is especially important. If there is any chance that files uploaded for anything can reveal their content to users, or even to other users on the same system.
Function is_uploaded_file () the variable $ _ FILES ['userfile'] ['tmp_name '] will upload the client variable of the file with the-name $ _ FILES ['userfile'] ['name'] does not work.
Parameters
File Name
The file name being checked.
Return Value
Returns TRUE or FALSE.
Instance
Example #1 is_uploaded_file ()
If (is_uploaded_file ($ _ FILES ['userfile'] ['tmp _ name']) {
Echo "File". $ _ FILES ['userfile'] ['name']. "uploaded successfully. n ";
Echo "Displaying contentsn ";
Readfile ($ _ FILES ['userfile'] ['tmp _ name']);
} Else {
Echo "Possible file upload attack :";
Echo "filename '". $ _ FILES ['userfile'] ['tmp _ name']. "'.";
}
?>