php 文件上传类(3)
来源:未知 责任编辑:责任编辑 发表时间:2015-10-08 14:15 点击:次
if($this->getFileErrorFromFILES!=0){
$this->setOptions('errorNum',-1);
return $this->errorNum;
}
$this->setOption('originName',$this->getFileNameFromFILES());
$this->setOption('tmpFileName',$this->getTmpFileNameFromFILES());
$this->setOption('fileType',$this->getFileTypeFromFILES());
$this->setOption('fileSize',$this->getFileSizeFromFILES());
}
private function setOption($key,$val){
$this->$key=$val;
}
private function setNewFileName(){
if($this->isRandName==false&&$this->isUserDefName==false){
$this->setOption('newFileName',$this->originName);
}elseif ($this->isRandName==true&&$this->isUserDefName=false){
$this->setOption('newFileName',$this->proRandName().'.'.$this->fileType);
}elseif ($this->isRandName==false&&$this->isUserDefName=true){
$this->setOption('newFileName',$this->userDefName);
}else {
$this->setOption('errorNum',-4);
}
}
private function checkValid(){
$this->checkFileSize();
$this->checkFileType();
}
private function checkFileType(){
if(!in_array($this->fileType,$this->allowType)){
$this->setOption('errorNum',-2);
}else {
return $this->errorNum;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>