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 ()
<? Php
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']. "'.";
}
?>