PHP Simple file image upload class
This file upload class can upload gif ",". jpg ",". Jar ",". Jad ",". Mid ",". mp3 ",". wav ",". Rm ",". wmv file Format "Oh, if you want to support other words, you can design $this- >file_type (); it's 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;
}
}
?>
http://www.bkjia.com/PHPjc/445032.html www.bkjia.com true http://www.bkjia.com/PHPjc/445032.html techarticle php Simple file image upload class This file upload class can upload gif,.jpg,.jar,.jad,.mid,.mp3,.mid,.bmp,.wav,.rm,.wmv file format Oh, if you want to support other words can design $ ...