I am trying to upload a file using rich:fileUploader and its not triggering the uploadListener be it whatever.
Here is the code, let me know if something is missing 🙂
<f:view>
<a4j:loadScript src="resource://jquery.js" />
<h:form id="uploadFileForm" prependId="false">
<rich:fileUpload immediateUpload="true"
listHeight="150px;" noDuplicate="true" listWidth="350px;"
maxFilesQuantity="1" locale="de"
fileUploadListener="#{paramFileUpload.fileUploadsListener}">
</rich:fileUpload>
</h:form>
</f:view>
public void fileUploadsListener(UploadEvent event) {
LOGGER.info("In ActionListener of file upload");
UploadItem item = event.getUploadItem();
LOGGER.info("item : " + item.getFileSize() + ", " + item.getContentType() + ", " + item.getData());
if(item.getFile() != null) {
LOGGER.info("File name and size : " + item.getFile().getPath() + ", " + item.getFile().getTotalSpace());
}
}
This is in web.xml
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
When page is loaded , the firebug console shows errro as below :
parentForm is null
ProgressBar={};ProgressBar=Class.creat...' {parentForm=parentForm.parentNode;}
And when file is chosen from file browser,
this.progressBar is undefined
if(this.labelMarkup){var progressData=...._fileSizeScriptTimeoutId=undefined;}
Finally I had to do it the
tomahawkway by defining a servlet inweb.xmland usingt:inputFileUploadto upload the file. This will inturn trigger my backing bean to yield a UploadedFile 🙂