/**
* Bkjia.com-Personal feeling is very simple, as long as a little php base drop people should be able to understand ~ ~
* Apache2 + PHP5.0
* version:1.0
* And thank Bkjia all the Brothers
* ————————————————————————————————— example-
* test.php @ processing Form file name
* *
* Include ("upload.php"); # Add Class file
* $f _upload = new Upload_other; # Create objects
* $f _upload->set_file_type ($_files[src][type]); # Get File types
* $f _upload->set_file_name ($_files[src][name]); # Get the file name
* $f _upload->set_file_size ($_files[src][size]); # Get File size
* $f _upload->set_upfile ($_files[src][tmp_name]); # Temporary file names stored on the server
* $f _upload->set_size (100); # Set the maximum number of uploads kb
* $f _upload->set_base_directory ("UploadImages"); # File Store root directory name
* $f _upload->set_url ("up.php"); # file to jump after successful upload
* $f _upload->save (); # Save File
*
*?>
* —————————————————————————————————— end-
*
* I do not have to do in the class has no document verification, we can be done at the front desk ~ ~
*
* —————————————————————————— form-
* upload.htm @ Form file name
*
*
*
* <title>File Upload Instance</title>
*
*
*
*
*
*
* ———————————————————————————— end-
*
* The above two files can be decided according to their own needs to merge or not merge ~ ~ If you have any problems in use can contact me ~ ~ ^_^
*
**/
/** File Upload class **/
Class Upload_file
{
/** Declaration **/
var $upfile _type, $upfile _size, $upfile _name, $upfile;
var $d _alt, $extention _list, $tmp, $arri;
var $datetime, $date;
var $filestr, $size, $ext, $check;
var $flash _directory, $extention, $file _path, $base _directory;
var $url; Jump path after successful file upload;
function Upload_file ()
{
/** Constructor **/
$this->set_url ("index.php"); Jump path after initial upload success;
$this->set_extention (); List of initialization extensions;
$this->set_size (50); Initialize upload file KB limit;
$this->set_date (); Set directory name;
$this->set_datetime (); Set the file name prefix;
$this->set_base_directory ("Attachmentfile"); Initialization file upload root directory name, can be modified!;
}
/** File Type **/
function Set_file_type ($upfile _type)
{
$this->upfile_type = $upfile _type; Obtain the file type;
}
/** get filename **/
function Set_file_name ($upfile _name)
{
$this->upfile_name = $upfile _name; Obtain the file name;
}
/** Get File **/
function Set_upfile ($upfile)
{
$this->upfile = $upfile; Obtain temporary file names stored on the server;
}
/** Get File Size **/
function set_file_size ($upfile _size)
{
$this->upfile_size = $upfile _size; Obtain file size;
}
/** set file upload after successful jump path **/
function Set_url ($url)
{
$this->url = $url; Set the jump path after uploading the file successfully;
}
/** get file extension **/
function Get_extention ()
{
$this->extention = Preg_replace (/.*. *[^.]. *) */iu,\1, $this->upfile_name); obtain a file extension;
}
/** Set file name **/
function Set_datetime ()
{
$this->datetime = Date ("Ymdhis"); Generate file names by time;
}
/** Set directory name **/
function Set_date ()
{
$this->date = Date ("y-m-d"); Generate catalog names by date;
}
/** initialization allows uploading of file types **/
function Set_extention ()
{
$this->extention_list = "Doc|xls|ppt|avi|txt|gif|jpg|jpeg|bmp|png"; The extension name that allows uploading by default;
}
/** set maximum upload KB limit **/
function Set_size ($size)
{
$this->size = $size; Set the maximum allowable upload file size;
}
/** Initialize the file Store root directory **/
function Set_base_directory ($directory)
{
&n
http://www.bkjia.com/PHPjc/486507.html www.bkjia.com true http://www.bkjia.com/PHPjc/486507.html techarticle PHP/** * php100.com-personal feeling is very simple, as long as a bit of PHP base drop people should be able to understand ~ ~ * Apache2 + PHP5.0 * version:1.0 * and thank all the brothers PHP100 * example...< /c5>