PHP 文件上传类
PHP 文件上传类,使用方法:
<?php$array = array( "clientFile" => "image_file", "savePath" => "/images/", "isRename" => true, "fileFormat" => "jpg,gif,bmp", "maxSize" => 10240 );$Upload = new Upload( $array );$result = $Upload->up();echo $result;?>
<?php/* php 文件上传类 author 下山的狼 lzshenyun date 2007-12-24*/class Upload{ private $clientFile; private $savePath; private $fileFormat; private $maxSize; private $fileName; private $fileExt; private $fileSize; private $errorMsg; public function setClientFile( $clientFile ) { $this->clientFile =
PHP 文件上传类,使用方法:
<?php$array = array( "clientFile" => "image_file", "savePath" => "/images/", "isRename" => true, "fileFormat" => "jpg,gif,bmp", "maxSize" => 10240 );$Upload = new Upload( $array );$result = $Upload->up();echo $result;?>
___FCKpd___1
FILES[$clientFile];}public function getClientFile(){return $this->clientFile;}public function setSavePath( $savePath ){$this->savePath = $savePath;}public function getSavePath(){return $this->savePath;}public function setFileFormat( $fileFormat ){$this->fileFormat = $fileFormat;}public function getFileFormat(){return $this->fileFormat;}public function setMaxSize( $maxSize ){$this->maxSize = $maxSize;}public function getMaxSize(){return $this->maxSize;}public function setFileName( $isRename ){if ( $isRename ){srand ((double) microtime() * 1000000);$rnd = date(''ymdhis'').rand(100,999);$this->fileName = $rnd .".". $this->getFileExt();}else{$this->fileName = $this->clientFile["name"];}}public function getFileName(){return $this->fileName;}public function setFileNameEx( $fileName ){$this->fileName = $补充:Php教程,Php常用代码