javascript – jQuery文件上传不显示预览

jQuery File Upload插件当前不显示所选文件.有谁知道我如何解决这个问题?

我已经实现了’自定义’模板(见下文);注意我不需要显示以前上传的材料,因此没有下载模板.

我已经检查(通过日志记录)正在调用add回调并且正在调用uploadTemplate函数并返回预期值 – 由于某种原因,这些值根本没有被附加到表示表.

$('#fileupload').fileupload(
  acceptFileTypes: /(\.|\/)(gif)$/i
  uploadTemplateId: null
  downloadTemplateId: null
  uploadTemplate: (obj) ->
    rows = $()
    $.each(obj.files,(idx,file) ->
      temp = "<tr class='template-upload fade'><td class='preview'><span class='fade'></span></td><td class='name'></td>'<td class='size'></td>"
      if (file.error)
        temp += "<td class='error' colspan='2'></td>"
      else
        temp += "<td><div class='progress'><div class='bar' style='width:0%;'></div></div></td><td class='start'><button>Start</button></td>"
      temp += "<td class='cancel'><button>Cancel</button></td></tr>"
      row = $(temp)
      row.find('.name').text(file.name)
      row.find('.size').text(obj.formatFileSize(file.size))
      rows = rows.add(row)
      )
    return rows
  downloadTemplate: ->
    return $()
)

更新10/16/2012
我在fileupload的初始化中添加了以下内容

process: [{action: 'load',fileTypes: /^image\/(gif|jpeg|png)$/,maxFileSize: 2000000},{action: 'resize',maxWidth: 1920,maxHeight: 1200,minWidth: 800,minHeight: 600},{action: 'save'}]

哪个会启动加载图像的尝试,但不幸的是,尝试会导致以下错误.有谁知道原因是什么和/或如何解决

未捕获的TypeError:undefined(loadImage)不是函数jquery.fileupload-fp.js:87

解决方法

问题是依赖项的加载顺序;需要在其他核心依赖项之前加载 Load Image.

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...