php 文件上传类(4)
来源:未知 责任编辑:责任编辑 发表时间:2015-10-08 14:15 点击:次
}
}
private function checkFileSize(){
if($this->fileSize>$this->maxSize){
$this->setOption('errorNum',-3);
}else {
return $this->errorNum;
}
}
private function checkFilePath(){
if(!file_exists($this->filePath)){
if($this->isCoverModer){
$this->makePath();
}else {
$this->setOption('errorNum',-6);
}
}
}
private function proRandName(){
$tmpStr= "abcdefghijklmnopqrstuvwxyz0123456789";
$str="";
for ($i=0;$i<8;$i++){
$num=rand(0,strlen($tmpStr));
$str.=$tmpStr[$num];
}
return $str;
}
private function makePath(){
if(!@mkdir($this->filePath,0755)){
$this->setOption('errorNum',-7);
}
}
private function copyFile(){
$filePath=$this->filePath;
if($filePath[strlen($filePath)-1]!='/'){
$filePath.='/';
}
$filePath.=$this->newFileName;
if(!@move_uploaded_file($this->tmpFileName,$filePath)){
相关新闻>>
- 发表评论
-
- 最新评论 更多>>