您可以尝试以这种方式首先检查具有相同名称的文件是否已经存在?如果退出,则删除旧的并上传新的。让我们尝试这样-//checking if file with same name already existsif(file_exists("pathtofile/boy.png")) unlink("pathtofile/boy.png");//upload file now using the move_uploaded_file()move_uploaded_file($fileLocTemporary, "pathtofile/boy.png"); # change as per your temp location