Question

I am using an inputFile component in jsff page where the user can browse the file system, select the file in order to store it in the database.

I created a ValueChangeListener method for this component which deal with this file and store it in db.

The problem is, once the user select the file it appears for a second in the page and it disappears and the ValueChangeListener is not called.

Note: the AutoSubmit property is set to true for this component. I am using JDeveloper 11g with ADF.

Was it helpful?

Solution

If autsubmit set to true, then your file is being submit as soon as user chooses it. You may want to turn it off and submit it when user clicks the submit button.

If your value property ain't preserved after submit (for example if you point to bean in backingBean scope), you will have no value as soon as submit completes. You can save it in viewscope variable for example.

Here is nice sample of how file uploads should be done.

Don't forget to set <af:form usesUpload="true">.

And one more link with Demo App included.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top