- 最后登录
- 2012-4-12
- 在线时间
- 50 小时
- 个人主页
- 注册时间
- 2011-2-17
- 阅读权限
- 50
- 帖子
- 50
- 精华
- 0
- UID
- 1592
 
|
发表于 2011-2-23 15:50:04
|显示全部楼层
icUpload
基于SpeedPHP的非官方文件上传类
此类不包含图片处理功能
@author Pony
安装方法
将 icUpload.php 放到 SpeedPHP/Extensions/ 目录下即可
简单使用示例html代码
- <form name="form1" enctype="multipart/form-data" method="post" action="http://localhost:1108/speedphp-upload/">
- <label>
- <input type="file" name="file" id="file">
- </label>
- </form>
复制代码
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 '文件上传失败';
复制代码
该贴已经同步到 Pony的微博 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?论坛注册
|