上传文件时候如何判断 文件名重复?
上传文件我知道
$_FILES["表单名字"]
$_FILES["表单名字"]["name"]名字
如何获取上传路径文档里面的图片名字?
<?php
class UpFile{
private $name;                 //名字
private $type; //类型
private $size; //大小
private $tempDirectory; //服务器的临时路径
private $directory; //的实际路径  (临时 移动 实际)
private $allowType; //允许的文件类型
private $error; function __construct($FILE){
$this->name = $FILE["name"];
$this->type = $FILE["type"];
$this->size = $FILE["size"];
$this->tempDirectory = $FILE["tmp_name"];
$this->directory = "../image/".$this->name; $this->allowType = array(
'image/jpg',
     'image/png',
    'image/gif',
    'image/pjpeg'
);
$this->error = $FILE["error"];
  }
function isUpFile(){                           //是否有文件 1或0 1代表有
return is_uploaded_file($this->tempDirectory);
}
function moveFile(){ //文件移动
move_uploaded_file($this->tempDirectory,$this->directory);
}
function iftype(){ //检查文件类型  unlink(路径);//文件删除方法
if(in_array($this->type,$this->allowType)){
return true;
}else{
return false;
}
}
function ifName(){
//如何判断上传的文件名与已上传的文件名重复
}
}
?>
<?php
include("UpFile.php");
$upfile = new UpFile($_FILES["upfile"]);?>
  <form action="" method="post" enctype="multipart/form-data">
  <p>上传文件模块</p>
  <input type="file" name="upfile" size="20"/><br/>
  <input type="submit" value="提交"/>
  </form>