Open landolphin opened 5 years ago
`$('#demo-fileInput-4').filer({ changeInput: '
', showThumbs: true, theme: "dragdropbox", limit:"1", extensions:['jpg','jpeg','png','gif'], / files: [ { name: "appended_file.jpg", size: 5453, type: "image/jpg", file: "http://dummyimage.com/720x480/f9f9f9/191a1a.jpg" }, { name: "appended_file_2.jpg", size: 9453, type: "image/jpg", file: "http://dummyimage.com/640x480/f9f9f9/191a1a.jpg" } ],/templates: {
box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>',
item: '<li class="jFiler-item">\
<div class="jFiler-item-container">\
<div class="jFiler-item-inner">\
<div class="jFiler-item-thumb">\
<div class="jFiler-item-status"></div>\
<div class="jFiler-item-info">\
<span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
<span class="jFiler-item-others">{{fi-size2}}</span>\
</div>\
{{fi-image}}\
</div>\
<div class="jFiler-item-assets jFiler-row">\
<ul class="list-inline pull-left">\
<li>{{fi-progressBar}}</li>\
</ul>\
<ul class="list-inline pull-right">\
<li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
</ul>\
</div>\
</div>\
</div>\
</li>',
itemAppend: '<li class="jFiler-item">\
<div class="jFiler-item-container">\
<div class="jFiler-item-inner">\
<div class="jFiler-item-thumb">\
<div class="jFiler-item-status"></div>\
<div class="jFiler-item-info">\
<span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
<span class="jFiler-item-others">{{fi-size2}}</span>\
</div>\
{{fi-image}}\
</div>\
<div class="jFiler-item-assets jFiler-row">\
<ul class="list-inline pull-left">\
<li><span class="jFiler-item-others">{{fi-icon}}</span></li>\
</ul>\
<ul class="list-inline pull-right">\
<li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
</ul>\
</div>\
</div>\
</div>\
</li>',
itemAppendToEnd: false,
removeConfirmation: true,
_selectors: {
list: '.jFiler-items-list',
item: '.jFiler-item',
remove: '.jFiler-item-trash-action'
}
},
uploadFile: {
url: "{$Site.BaseURL}/public/index.php/crm/Staff/upload",
data: null,
type: 'POST',
enctype: 'multipart/form-data',
beforeSend: function(){},
success: function(data, el){
var parent = el.find(".jFiler-jProgressBar").parent();
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow");
});
var json=eval(data);
//上传成功后
// alert(json.data.src)
console.log(data);
},
error: function(el){
var parent = el.find(".jFiler-jProgressBar").parent();
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow");
});
},
statusCode: null,
onProgress: null,
onComplete: null
},
//删除文件
onRemove: function(itemEl, file){
var file = file.name;
// $.post('./php/remove_file.php', {file: file});
alert('xxx');
}
}); `
`public function upload(){
$files = request()->file('files');
foreach($files as $file){
$info = $file->move( '../uploads/admin/');
if($info){
$filename=$info->getSaveName();
//上传到七牛云
$qiniu_event =controller('crm/Upload', 'behavior');
$PusFile="../uploads/admin/".$filename;
$qiniuurl=$qiniu_event->run($PusFile);
// unlink($PusFile);
// $data=["code"=>0,"msg"=>0,"data"=>["src"=>"{$qiniuurl}"]];
// exit(json_encode($data));
print_r($files);
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
`
Hi, I use the Chinese ThinkPHP framework. The framework's upload class. Is the php return parameter the above? Also, how do I get the name of the uploaded file?