Reputation: 2094
I have xhtml file that uploads pictures pdf and txt files. code below
<rich:fileUpload fileUploadListener="#{DfeOper017MBean.listener}" listWidth="600px"
maxFilesQuantity="#{DfeOper017MBean.uploadsAvailable}"
id="upload"
styleClass="additionalMarginTop"
transferErrorLabel="Wystąpiły problemy. Sprawdź, czy plik został przesłany."
noDuplicate="true" immediate="true" ajaxSingle="true"
immediateUpload="#{DfeOper017MBean.autoUpload}"
allowFlash="#{DfeOper017MBean.useFlash}"
acceptedTypes="#{DfeOper017MBean.svAcceptedExtTypes}"
addControlLabel="${msg['page.dfeOper017form.fileUpload.addControlLabel']}"
clearAllControlLabel="${msg['page.dfeOper017form.fileUpload.clearAllControlLabel']}"
clearControlLabel="${msg['page.dfeOper017form.fileUpload.clearControlLabel']}"
stopEntryControlLabel="${msg['page.dfeOper017form.fileUpload.stopEntryControlLabel']}"
uploadControlLabel="${msg['page.dfeOper017form.fileUpload.uploadControlLabel']}"
cancelEntryControlLabel="${msg['page.util.abort']}"
ontyperejected="alert('The selected file type is not supported.')"
doneLabel="${msg['page.util.ok']}" status="waitStatus">
<f:facet name="label">
<h:outputText value="{_KB}KB z {KB}KB" />
</f:facet>
<a4j:support event="onuploadcomplete" reRender="docsInfoPanel"/>
</rich:fileUpload>
Issue is when i save a file with a space before .txt extention and try to upload i get the error alert as above ''The selected file type is not supported.', How can i make sure the filename is trimed. ? example of file that fail is "filename .txt", it failes before listner (DfeOper017MBean.listener) is triggered. before it gets to java
I think issue is with rich:fileUpload, but i cant confirm it, any suggestions ?
Upvotes: 1
Views: 74
Reputation: 3884
The filenames are checked with /(?:\S+)\.(\S+)$/
so your files won't pass; either rename those files or overwrite the file checking method (FileUpload.checkFileType
) or upgrade to RF 4.
Upvotes: 3