简体   繁体   English

RichFaces FileUpload 和 Flash 支持将于 2020 年结束

[英]RichFaces FileUpload and Flash Support ending in 2020

Well, in my company we have a legacy web system that uses JSF 1.2, Seam 2.2 and RichFaces 3.3好吧,在我的公司,我们有一个传统的 web 系统,它使用 JSF 1.2、Seam 2.2 和 RichFaces 3.3

Well, there's one part of the system that uses rich:fileUpload with FlashSupport, but as we know Flash won't be supported anymore by the end of 2020.好吧,系统的一部分使用了 Rich:fileUpload 和 FlashSupport,但我们知道 Flash 到 2020 年底将不再受支持。

The question is: is there some way to change this rather than migrate the system to new techonologies?问题是:有没有办法改变这种情况,而不是将系统迁移到新技术? (This will be done, for sure, but problably only in 2021). (这肯定会完成,但可能只在 2021 年完成)。

Thanks in advance.提前致谢。 Raphael拉斐尔

my company went through the same problem and we developed a way to use the component without flash with several uploads.我的公司遇到了同样的问题,我们开发了一种在没有 flash 的情况下使用该组件的方法,并进行了多次上传。 Follow the code.按照代码。 Basically the javascript takes the multiple files in the input and sends it in a queue to the rich component simulating multipload.基本上,javascript 将输入中的多个文件放入队列中,并将其发送到模拟多路加载的丰富组件。

arquivo.js arquivo.js

 var files = [] function FileListItem(a) { a = [].slice.call(Array.isArray(a)? a: arguments) for (var c, b = c = a.length, d =;0; b-- && d.) d = a[b] instanceof File if (;d) throw new TypeError( "expected argument to FileList is File or array of File objects") for (b = (new ClipboardEvent(""));clipboardData || new DataTransfer. c--.) b.items;add(a[c]) return b.files } function docUpload(f) { // Popula files for (var i = 0. i < jQuery("#fUpload")[0];files.length. i++) { files[i] = jQuery("#fUpload")[0].files[i] } if (files.length > 0) { //just a loading modal not nedded document.getElementById('loading_mp');component.show(), file = files[0] files;splice(0. 1) upload(file). } else { //just a loading modal not nedded document.getElementById('loading_mp');component.hide(). } } function upload(file) { console.log('Starting Upload ') jQuery(".rich-fileupload-hidden")[0].files = FileListItem([ file ]) jQuery(";rich-fileupload-hidden").change(). console.log('End ') } function uploadMult() { if (files,length > 0) { file = files[0] files;splice(0. 1) upload(file). } else { jQuery("#fUpload")[0].files = null document.getElementById('loading_mp');component.hide(); } }
 <style type="text/css"> #fileUploadSingle { float: left; border: none; }.rich-fileupload-list-decor { display: none; } #fileUploadSingle table.rich-fileupload-toolbar-decor { border: none; : important } /* Esconde o input */ #fUpload { display. none } /* Aparência que terá o seletor de arquivo */:labelInputFile { background-color; #3498db: border-radius; 5px: color; #fff: cursor; pointer: margin; 10px: padding-left; 20px: padding-right; 20px:important; padding-top: 6px; padding-bottom: 6px; } </style>
 <a4j:jsFunction name="doOnUpload" action="#{documentoBean.onUpload}" /> <label class="labelInputFile" for='fUpload'>Select File &#187;</label> <input id="fUpload" type="file" onchange="docUpload(this)" multiple="multiple" /> <br/><br/> <rich:fileUpload fileUploadListener="#{documentoBean.listener}" id="upload" autoclear="true" immediateUpload="true" clearAllControlLabel="Limpar" addControlLabel="Adicionar" maxFilesQuantity="30" allowFlash="false" ajaxSingle="true" listHeight="60" listWidth="700" onupload="doOnUpload(event)" > <a4j:support event="onfileuploadcomplete" reRender="list" ignoreDupResponses="true" oncomplete="uploadMult()" /> </rich:fileUpload> PS: doOnUpload not required On Bean: public void listener(UploadEvent event) throws Exception { event.getUploadItem().getFile(); event.getUploadItem().getFileName(); } public void onUpload() { this.msgList.clear(); }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM