在Fileselect之后Plupload Html5预览

http://jsfiddle.net/VjeTk/78/

使用Plupload.com文件上传器

我想在html5运行时浏览器选择文件后预览图像。

因此我添加了FilesAdded事件

uploader.bind('FilesAdded', function(up, files) { for (var i in files) { $('filelist').innerHTML += '
' + files[i].name + ' (' + plupload.formatSize(files[i].size) + '')
'; } });

问题是Plupload没有像html那样提供通常的二进制文件对象。 谢谢你的帮助。

Plupload 2有一个图像对象,您可以使用它: https : //github.com/moxiecode/moxie/wiki/Image

File.getSource()mOxie.Image.embed()是您感兴趣的方法。

https://github.com/moxiecode/plupload/wiki/File#wiki-getSource–method

https://github.com/moxiecode/moxie/wiki/Image#wiki-embed-eloptions-method

jQuery UI队列小部件使用它。

这是一个自定义上传器的工作示例: http : //jsfiddle.net/Ec3te/2/

即使在不支持HTML5 File API的浏览器中也可以使用(是的,甚至是IE6)。