I am using primefaces 4.0 with websphere 8.5.I am just doing simple file upload
<h:form enctype="multipart/form-data" id="frm">
<p:fileUpload id="uploadFile" value="#{backingbean.file}" mode="simple" />
<p:commandButton id="save" value="save" action="#{backingbean.save}" update="@form" ajax="false">
</p:commandButton>
</h:form>
I have to put a warning if uploaded file is not a recommended type which could be doc,xls etc.But if it is not that type then i have to throw a warning message but User can still save the file.So in the backingbean save method I am checking the file type and throwing the warning message.When i press save button, it goes to the backingbean save method checks the file type and throws the warning message.But the uploaded file becomes blank.I want the file to be there so that user can ignore the warning and save it and the user does not have to choose the file again.
I am not sure if it is the default behavior that the file becomes blank/null when the form loads back after submitting.
Thanks
Ankita
fileupload validation problem , file becomes null
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
Mode simple uploads require that you save the file during the upload request. If you need an additional step to confirm that the file be kept, delete the file if the user doesn't want to keep it.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 48 guests