首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

PHP5+UTF8多文件上传类

整理日期:2008年08月10日 【字体:

根据需要写了个PHP5+UTF8环境的文件上传类,支持多文件上传,并对常用文件的类型进行MIME检测.

还有些功能没有加上去,如自动更名,图片处理等.可根据需要自己添加.

USE:

$up = new upfile(ROOT_PATH.'data/'.date("Ym",time()),array('gif','jpg','jpeg'),true);
$fileimg = $up->upload($_FILES['img']);//返回上传后文件名数组,$_FILES['img']为上传的文件


可使用$up->log查看上传时信息.

<?php
//====================================================
// FileName: upfile.class.php
// Summary: 文件上传类
//====================================================
if(!defined('OK'))exit(__FILE__.'Access Denied');
class upfile {
public $ExtensionFileFormat = array();
public $returninfo = array();

private $ImageFileFormat = array('gif','bmp','jpg','jpe','jpeg','png');
private $OtherFileFormat = array('zip','pdf','rar','xls','doc','ppt','csv');
private $savePath;
private $attachment_path = './upfiles/';
private $overwrite = false; # 同名时是否覆盖
private $maxSize = 0; # 文件最大字节,为0时不限制大小
private $ext;
private $errno = 0;

/* 构造函数
* (string)$savePath 文件保存路径,默认为$attachment_path
* (array)$extensionFileFormat 自定义上传文件的扩展名,未设置时为$ImageFileFormat || $OtherFileFormat

伊图教程网[www.etoow.com]
http://www.etoow.com/html/2008-08/1218329011.html
* (bool)$overwrite 是否覆盖同名文件
Tags:
PHP5+UTF8多文件上传类
'http://www.etoow.com/html/2008-08/1218329011.html
1
 
2
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved