• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to enable the user to upload a new File using rich:fileUpload on maximum file size reached error

 
Sudha Ramasamy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to upload a file using rich:fileupload component, I've configured maximum file size in web.xml seam Filter configuration like the following
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
<init-param>
<param-name>createTempFiles</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>maxRequestSize</param-name>
<param-value>262144</param-value>
</init-param>
</filter>

so when the uploaded file reached the maximum size, file upload will be aborted and the 'maximum file size reached' error is displayed in the UI, but in order to enable the user to upload a new file I had to reRender the panel where my rich:uploadfile component is, I'm doing that reRender in onuploadcomplete event, but this event gets triggered regardless of whether or not the fileUpload is aborted due to maximum isze reached error occurred. so on doing reRender when the error has occurred, the error message will disappear before even the user gets the chance to see the error,
Is there a way to listen to file upload aborted event? or how to enable the user to upload a newFile using rich:fileUpload without reRendering?

If I don't do the validation through seam filter, I can configure it in components.xml and read the configuration in components.xml using java code in server side and display custom error message.
<web:multipart-filter create-temp-files="true"
max-request-size="1000000"
url-pattern="*.seam"/>

But I don't know how to read the configuration in components.xml in server side.
Do anyone know how to solve this issue ?

Thanks,
Sudha
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic