PHP头条
热点:

php文件上传类(该类支持单个或者多个文件上传)(1/2)


php文件上传类(该类支持单个或者多个文件上传) /** * 类名:upfile * 作用:处理文件上传 * 说明,该类处理单个或者多个文件上传,使用该类时,只需要实列化该类 * 例:

/php教程文件上传类(该类支持单个或者多个文件上传)
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<?php
//php文件上传类(该类支持单个或者多个文件上传)
 /**
 * 类名:upfile
 * 作用:处理文件上传
 * 说明,该类处理单个或者多个文件上传,使用该类时,只需要实列化该类
 * 例:
 * $up = upfile()
 * $up->update_file($_file['filename'])
 *
 * $up->update_file   函数返回一个数组,如果是多文件上传,则为多维数据。
 * 数组的内容:
 * $fileinfo['file_size']   上传文件的大小
 * $fileinfo['file_suffix'] 上传文件的类型
 * $fileinfo['file_name']   上传文件的名字
 * $fileinfo['error']     上传文件产生的错误
 *

 */
class upfile {
 public $fcount = 1;           //上传文件的数量
 public $ftype  = array('jpg','jpeg','gif','png');  //文件格式
 public $fsize  = 1024;          //文件大小单位kb
 public $fdir   = 'www.111cn.net/';         //文件存放目录
 public $errormsg = '';          //产生的临时错误信息

 /**
  *函数名:get_tmp_file($putfile)
  *作用:取得上传的临时文件名
  *@param array $putfile
  *@return string $upimg 返回临时文件名
  */
  function get_tmp_file($putfile){
  if($this->fcount == 1){
   $tmpfile = $putfile['tmp_name'];
  }else{
   for($i=0;$i<$this->fcount;$i++){
    $tmpfile[] = $putfile['tmp_name'][$i];
   }
  }
  return $tmpfile;
  } 1 2

www.phpzy.comtrue/php/11826.htmlTechArticlephp文件上传类(该类支持单个或者多个文件上传)(1/2) php文件上传类(该类支持单个或者多个文件上传) /** * 类名:upfile * 作用:处理文件上传 * 说明,该类处理单个或者多个文件上传,使用该...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐