Balakumar B
Balakumar B

Reputation: 790

how to use data-jfiler-files in jquery filer?

i have used jquery filer, i have tried to EDITMODE in jquery filer using data-jfiler-files attribute.

but i didn't get result.. what mistake i did?

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" />

I have also tried to following way It has worked fine

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

Upvotes: 0

Views: 1112

Answers (1)

Creativedream
Creativedream

Reputation: 89

Try this data-jfiler-files='<?php echo json_encode($dummyarr1);?>'

Upvotes: 0

Related Questions