This content has been marked as final.
Show 3 replies
-
1. Re: fileUpload determination of multiple files
nbelaevski Jun 6, 2009 10:03 AM (in response to freemarket)Hi Henry,
You can check the source: http://fisheye.jboss.org/browse/~raw,r=14034/RichFaces/trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js -
2. Re: fileUpload determination of multiple files
freemarket Jun 6, 2009 9:57 PM (in response to freemarket)"nbelaevski" wrote:
Hi Henry,
You can check the source: http://fisheye.jboss.org/browse/~raw,r=14034/RichFaces/trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Hi NIck,
Please confirm. I only see it server side:./framework/api/src/main/java/org/richfaces/event/UploadEvent.java:55: public UploadItem getUploadItem() { ./framework/api/src/main/java/org/richfaces/event/UploadEvent.java:67: public List<UploadItem> getUploadItems() { ./framework/api/src/main/java/org/richfaces/event/UploadEvent.java:75: public boolean isMultiUpload() { ./framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java:731: public List<UploadItem> getUploadItems () {
and not client side:hkatz@saillon[13]: egrep '(ismultiupload|getuploaditems|getUploadItem)' ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/*
hkatz@saillon[14]: pwd
/opt/richfaces/3.3.0.GA/src
Regards,
Henry -
3. Re: fileUpload determination of multiple files
freemarket Jun 9, 2009 3:50 PM (in response to freemarket)Nik,
I've implemented a client-side solution for limiting the number of files viewable in the display area of the fileupload widget to 1:<rich:fileUpload fileUploadListener="#{bulkUpload.listener}" id="bulkUpload-upload-input" immediateUpload="false" maxFilesQuantity="10000" listHeight="80px" listWidth="350px" acceptedTypes="xml" addControlLabel="Select file" onadd="clearToPenult(FileUploadEntry.getComponent(this).entries)" uploadControlLabel="Submit file" reRender="bulkUpload-response-panel"> <a4j:support event="onuploadcomplete" reRender="errorMessagebulkUpload,bulkUpload-response-panel"/> </rich:fileUpload>
where clearToPenult() is the following javascript fn:function clearToPenult(myEntries) { for (var i = 0; i < myEntries.length - 1; i++) { myEntries._clearEntry(); } }
So basically by manipulating the complete list of entries that the FileUploadEntry object contains, one can simulate the update of the list to allow only 1 file.
Cheers,
Henry