(1)下载的h5上传代码,除了phpcms\modules\attachment\attachments.php不上传,其他上传
(2)找到压缩包里边的phpcms\modules\attachment\attachments.php里的53行附件的public function swfupload 方法,复制整个方法,然后放到你的网站的phpcms\modules\attachment\attachments.php的57行左右的public function h5upload方法上面,把swfupload改成h5upload,把原来的h5upload随便改个名字别重复就行
(3)找到phpcms\modules\attachment\templates\webuploader.tpl.php找到103行里边的a=swfupload改成a=h5upload
(4)找到modules\attachment\functions\global.func.php添加方法:
- /**
- * 读取swfupload配置类型
- * @param array $args flash上传配置信息
- */
- function getswfinit($args) {
- $siteid = get_siteid();
- $site_setting = get_site_setting($siteid);
- $site_allowext = $site_setting['upload_allowext'];
- $args = explode(',',$args);
- $arr['file_upload_limit'] = intval($args[0]) ? intval($args[0]) : '8';
- $args['1'] = ($args[1]!='') ? $args[1] : $site_allowext;
- $arr_allowext = explode('|', $args[1]);
- foreach($arr_allowext as $k=>$v) {
- $v = '*.'.$v;
- $array[$k] = $v;
- }
- $upload_allowext = implode(';', $array);
- $arr['file_types'] = $upload_allowext;
- $arr['file_types_post'] = $args[1];
- $arr['allowupload'] = intval($args[2]);
- $arr['thumb_width'] = intval($args[3]);
- $arr['thumb_height'] = intval($args[4]);
- $arr['watermark_enable'] = ($args[5]=='') ? 1 : intval($args[5]);
- return $arr;
- }
清除缓存,测试效果
文章点评