在这里寻求帮助。
由于某种原因,file_exists()对我不起作用。
始终上传文件并替换旧文件。它应该显示消息文件已经存在。
思想?
由于 大道
if (!empty($_GET['action'])&& $_GET['action']=='save'){
$path = "../uploads/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
$uploadOK = 1;
if (file_exists($path)) {
$message = array("type" => "info", "message" => "file already exists.");
$uploadOk = 0;
}
if ($uploadOk = 1) {
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
$message = array("type" => "info", "message" => "File has been uploaded.");
} else{
$message = array("type" => "info", "message" => "Error please try again.");
}
}
}