相关疑难解决方法(0)

jQuery文件上载不显示预览

jQuery的文件上传插件不显示当前选中的文件.有谁知道我如何解决这个问题?

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

我已经检查(通过日志记录)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 $()
)
Run Code Online (Sandbox Code Playgroud)

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

  process: [{action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery file-upload coffeescript

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

coffeescript ×1

file-upload ×1

javascript ×1

jquery ×1