PHP Simple file image upload Class _php tutorial

Source: Internet
Author: User
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 $ ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.