当我单击上传按钮时,给定运行时 silverlight , 然后什么也没有发生
适用于 html5 和 flash。我现在正在彻底测试,因为 IE 出现了 plupload flash 的错误(未设置容器,这吓坏了 IE。)为了确保没有更多的错误,我尝试将 silverlight 作为唯一的运行时进行测试,遗憾的是导致了这个无声错误。它在 FF、Mac 上的 chrome 或 Windows 上的 IE9 中都不起作用。
我正在使用 Backbone 和 coffeescript(Rails 3 应用程序)这就是我在class window.Uploader extends Backbone.View
. 请记住,它使用 flash 和 html5 作为运行时:
initialize: (options) ->
@uploader = new plupload.Uploader({
runtimes : 'silverlight,flash', #'gears,html5,flash,silverlight,browserplus',
browse_button : 'pickfiles',
container: 'upload_container'
max_file_size : '5mb',
url : "/admin/upload",
flash_swf_url : '/publiclib/plupload.flash.swf',
silverlight_xap_url : '/publiclib/plupload.silverlight.xap',
filters : [ {title: "#{filter_title} ", extensions : "#{filter_extentions}"}]
multi_selection: that.multiple,
multipart: true,
multipart_params: {
"authenticity_token" : FORM_AUTH_TOKEN
},
file_data_name: 'photo'
})
###### THIS PRINTS SILVERLIGHT as runtime, in all browser I've tested for this Q
###### So it is used/detected, but not working
@uploader.bind 'Init', (up, params) ->
$('#filelist').html("<div>Current runtime: #{params.runtime} </div>")
@uploader.init()
@setupBindings()
setupBindings: ->
#instantiates the uploader
that = @
# shows the progress bar and kicks off uploading
@uploader.bind 'FilesAdded', (up, files) ->
_.each files, (file) ->
$('#filelist').append('<div id="' + file.id + '"><small>' + file.name + ' (' + plupload.formatSize(file.size) + ') </small><b></b>' + '<div class=" percent label notice" style="width:10%;"><span>Laster opp</span></div></div>')
that.uploader.start()
#binds progress to progress bar
@uploader.bind 'UploadProgress', (uploader, file) ->
# .. some upload code, not relevant to Q
这是我的 _form.html.erb(请原谅我不喜欢 haml)
<div id="upload_container" class="clearfix">
<div class='input'>
<div class='clearfix'>
<%=activity_image @activity%>
</div>
<%=link_to "Choose Picture", '#', :id => "pickfiles", :class => "btn small"%>
<div class='clearfix' id='filelist'>
</div>
</div>
</div>
根据评论中的要求生成html...:
<fieldset>
<input id="activity_photo_id" name="activity[photo_id]" size="30" style="display:none;" type="text" />
<legend>choose picture for upload</legend>
<div id="upload_container" class="clearfix">
<div class='input'>
<div class='clearfix'>
<img src='/assets/default_photo.png' id='image_preview'>
</div>
<a href="#" class="btn small" id="pickfiles">Choose Picture</a>
<div class='clearfix' id='filelist'></div>
</div>
</div>
</fieldset>
当我单击“选择图片”时,没有任何反应。
下载 1.5.1.1