1、根据数据自动生成的add.html
<div class="input-group-addon no-border no-padding"> <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> </div>
2、调用了faupload组件上传 publicassetsjsrequire-form.js
faupload: function (form) { //绑定上传元素事件 if ($(".plupload,.faupload", form).size() > 0) { Upload.api.upload($(".plupload,.faupload", form)); } },
3、调用了public、assets、js、require-upload.js
var url = $(this).data("url");url = url ? url : Config.upload.uploadurl;
这段代码表示,看一下组件是否有设置上传的控制器路径,如果没有就使用默认的路径ajax/upload。其中api调用的是common/upload
4、后台config获取设置Config.upload.uploadurl
applicationcommoncontrollerBackend.php的以下代码获取$upload = appcommonmodelConfig::upload(); // 监听插件上传信息配置Hook::listen("upload_config_init", $upload);
5、后台前端设置示例$(this).data("url"):
示例一:<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('qiexam/article/law/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>示例二:<div id="plupload-local" class="plupload" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> 上传</div>
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。