fineuploader - initial file list

瘦欲@ 提交于 2019-12-13 04:43:00

问题


I am using fineuploader (4.2) jquery version in a zf2 application. I am looking for help in getting the initial file list functionality working.

Using fineuploader to upload the files, they are physically saved in the public/client-images directory. The uuid, filename, filesize are then saved in the database.

To populate the initial file list, i have the following jquery:

<script>
  $(document).ready(function () {
    var manualUploader = $('#jquery-wrapped-fine-uploader').fineUploader({
      session : {
        endpoint : 'json/' + $("#userId").text(),  
      },
      paramsInBody : true,
      template: "qq-simple-thumbnails-template",
      thumbnails: {
          placeholders: {
            waitingPath: "/js/jquery.fineuploader-4.2.0/placeholders/waiting-generic.png",
            notAvailablePath: "/js/jquery.fineuploader-4.2.0/placeholders/not_available-generic.png"
          }
      },
      autoUpload: false,
      editFilename: {
        enabled: true
      }
    });

    manualUploader.on("sessionRequestComplete", function (event, response, success, rawData){
        alert(success);
    });

    $('#triggerUpload').click(function() {
        manualUploader.fineUploader('uploadStoredFiles');
      });
  });
</script>

I am looking at retrieving the uploaded images of userId (eg 53) with the following url: domain/images/client-images/json/53 When i manually type this url in my browser i get the following json response:

[[{"image":{"name":"IMAG0124.JPG","uuid":"913dee8e-bd0b-4fc7-ba69-83fa23c86372","size":"1336238","id":"29","user_id":53}}]]

However this response when called from fineuploader gives me the following message in firebug:

[FineUploader 4.2.0] Session response item 0 did not include a valid UUID - ignoring.

I'm assuming this is because fineuploader is looking for a directory named with the uuid and is not finding it. Is there an option that i can set that defines a "base" directory that all uuid named directories are stored in? I cannot store the full path of the directory (ie "/public/client-images/913dee8e-bd0b-4fc7-ba69-83fa23c86372") as the uuid in the database, as the json response escapes the backslashes/directory separators.


回答1:


You are not returning a proper response to Fine Uploader's GET initial files request.. Fine Uploader is looking for an array of objects. You are returning an array of an array of objects.



来源:https://stackoverflow.com/questions/21493305/fineuploader-initial-file-list

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!