【发布时间】:2017-07-28 23:47:00
【问题描述】:
我使用过 jquery 文件管理器,我尝试使用data-jfiler-files 属性在 jquery 文件管理器中编辑模式。
但我没有得到结果..我做错了什么?
PHP
<?php
$dummyarr1 = array();
foreach($templateVal_array['media_src'] as $Ind){
$dummyarr = array();
$dummyarr['name'] = $Ind['oname'];
$dummyarr['size'] = (int)str_replace(',', '', $Ind['size']);
$dummyarr['type'] = "image/jpg";
$dummyarr['file'] = "http://localhost/datacapture/evt/media_src/".str_replace(' ', '_', $Ind['fname']).".".$Ind['ext'];
$dummyarr1[] = $dummyarr;
}
?>
<input type="file" name="media_src[]" class="filepicker-custom" data-jfiler-files = <?php echo json_encode($dummyarr1); ?> multiple="multiple" />
我也尝试了以下方法,效果很好
$(".filepicker-custom").filer({
limit: 3,
maxSize: 3,
extensions: ["jpg", "jpeg", "png", "gif", "txt", "docx", "doc", "pdf"],
showThumbs: true,
addMore: true,
files: [{
name: "appended_file.jpg",
size: 777835,
type: "image/jpg",
file: "http://localhost/datacapture/evt/media_src/Avg_rain_fall-58bfd786d435c.jpg",
},{
name: "appended_file_2.png",
size: 620888,
type: "image/png",
file: "http://localhost/datacapture/evt/media_src/Avg_rain_fall-58bfd786d435d.jpg",
}]
});
【问题讨论】:
标签: php jquery jquery-filer