Home > php教程 > php手册 > php 简单文件图片上传类

php 简单文件图片上传类

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:22:21
Original
1315 people have browsed it

php 简单文件图片上传类

这个文件上传类可以上传gif",".jpg",".jar",".jad",".mid",".mp3",".mid",".bmp",".wav",".rm",".wmv文件格式哦,如果你还想支持其它的话可以设计$this->file_type();就OK了,。

class upload{

var $file_type;
var $file_size;
var $file_name;
var $exname;
var $datetime;


function up($post_name,$path){
 $this->file_name=$_FILES[$post_name]["name"];
 $this->exname=strtolower(substr($this->file_name,strrpos($this->file_name,".")));
 $this->file_size=$_FILES[$post_name]["size"];
 $this->file_type=array(".gif",".jpg",".jar",".jad",".mid",".mp3",".mid",".bmp",".wav",".rm",".wmv");
 $this->datetime=date("YmdHis");
 if(!in_array($this->exname,$this->file_type)){
  print("");
  break;
 }elseif($this->file_size>"50000"){
  print("");
  break;
 }else{
  move_uploaded_file($_FILES[$post_name]["tmp_name"],$path.$this->datetime.$this->exname);
  }
}

function fileName(){
   $pic=$this->datetime.$this->exname;
   return $pic;
}

}
?>
 


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template