fineuploader-初始文件列表 [英] fineuploader - initial file list

查看:36
本文介绍了fineuploader-初始文件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在zf2应用程序中使用fineuploader(4.2)jquery版本.我正在寻求有关使初始文件列表功能正常工作的帮助.

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.

使用fineuploader上传文件,这些文件实际保存在public/client-images目录中.然后将uuid,文件名和文件大小保存在数据库中.

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.

要填充初始文件列表,我需要以下jquery:

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>

我正在使用以下URL检索userId(例如53)的上传图像:domain/images/client-images/json/53 当我在浏览器中手动键入此URL时,得到以下json响应:

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}}]]

但是,当从fineuploader调用时,此响应在萤火虫中给了我以下消息:

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

[FineUploader 4.2.0]会话响应项0不包含有效的UUID-忽略.

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

我认为这是因为fineuploader正在查找以uuid命名的目录,但未找到该目录.我可以设置一个选项来定义所有"uuid"命名目录都存储在其中的基本"目录吗?我无法将目录的完整路径(即"/public/client-images/913dee8e-bd0b-4fc7-ba69-83fa23c86372")存储为数据库中的uuid,因为json响应会转义反斜杠/目录分隔符. >

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.

推荐答案

您没有对Fine Uploader的GET初始文件请求返回正确的响应.Fine Uploader正在寻找对象数组.您将返回一个对象数组.

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.

这篇关于fineuploader-初始文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆