#1 Pony
icUpload基于SpeedPHP的非官方文件上传类
此类不包含图片处理功能
@author Pony
安装方法
将 icUpload.php 放到 SpeedPHP/Extensions/ 目录下即可
简单使用示例html代码
php代码
$test = spClass('icUpload',array('file'));//array('file')对应的是html中的 name="file"
$test -> save();//至此,完成了最简单的文件上传,文件保存至 ./tmp/ 目录下
全功能的使用示例
$test = spClass('icUpload',array('file'));//array('file')对应的是html中的 name="file"
$allowtype = array('txt'=>TRUE,'rar'=>TRUE);//设置允许上传.txt和.rar文件,不允许上传其它类型
$test -> set('ALLOW_SUFFIX',$allowtype);//使用set函数操作设置
$test -> set('MAXSIZE',102400);//使用set函数设置,最大允许上传文件大小为102400字节,即100KB
$test -> set('SAVEPATH','./');//使用set函数设置,文件保存路径为根目录,此处可以输入相对路径或绝对路径
$filepath = $test -> save('hello.txt');//保存到服务器上的文件名是hello.txt
if($filepath != FALSE) echo '文件上传成功,文件的路径为'.$filepath;
else echo '文件上传失败';
speedphp-upload.rar
2011-02-23 15:50:04