I am using Richfaces 2.0 fileupload to upload one file.
But in my case i just want to click in one link and see the browser to select the file. So in my code i have commandLink:
<a4j:commandLink id="showFileUpload"
execute="@this"
action="#{doSomething.Something(a)}"
render="@none"
oncomplete="#{rich:element('stratFileUpload')}.click();"
>
<h:graphicImage value="/images/A.png" />
</a4j:commandLink>
And the part of the fileUpload is just a form with the fileUpload on it:
<h:form id="stratFileUploadForm">
<rich:fileUpload id="stratFileUpload" execute="@this"
fileUploadListener="#{doUploadedFile}"
onuploadcomplete="
jQuery(#{rich:element('stratFileUpload')}).find('.rf-fu-itm-lnk').click();
"
noDuplicate="true" maxFilesQuantity="1"
sizeExceededLabel="#{msg['sizeExceeded']}"
uploadLabel="#{msg['upload']}" />
</h:form>
I already call in the commandLink the id form and rich:fileUpload id but nothing works.
The only way for this to work is with popup, and in that case it came with the "+ Add" button.