如何在jquery文件管理器中使用data-jfiler-files?

时间:2017-03-08 12:01:56

标签: php jquery jquery-filer

我使用过jquery文件管理器,我尝试使用data-jfiler-files属性在jquery文件管理器中编辑EDITMODE。

但我没有得到结果..我做错了什么?

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",
   }]
});

1 个答案:

答案 0 :(得分:0)

试试这个data-jfiler-files='<?php echo json_encode($dummyarr1);?>'