在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 $()
)
更新2012年10月16日我增加了以下文件上传到的初始化:
process: [{action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: 2000000}, {action: 'resize', maxWidth: 1920, maxHeight: 1200, minWidth: 800, minHeight: 600}, {action: 'save'}]
这确实开始尝试加载图像,但不幸的是,在下面的错误尝试的结果。 有谁知道是什么原因和/或如何解决呢?
Uncaught TypeError: undefined (loadImage) is not a function jquery.fileupload-fp.js:87