The move_uploaded_file()
function moves the uploaded file to a new location.
Return true if successful, otherwise return false.
move_uploaded_file ( file , newloc )
parameter | describe |
---|---|
file | Required. Specify the files to be moved. |
newloc | Required. Specify the new location of the document. |
This function checks and ensures that the file specified by the file is a legal upload file (that is, uploaded through PHP's HTTP POST upload mechanism). If the file is legal, move it to the file specified by newloc .
If the file is not a legal upload file and no operation occurs, move_uploaded_file()
will return false.
If the file is a legal upload file, but cannot be moved for some reason and no action occurs, move_uploaded_file()
will return false, and a warning will be issued.
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.