0

我使用过 jquery filer,我尝试使用data-jfiler-files属性在 jquery filer 中编辑模式。

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

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

1 回答 1

0

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

于 2017-04-19T10:26:07.763 回答