-
1. Re: JS API for RichFaces fileUpload
michpetrov Nov 19, 2014 9:50 AM (in response to michal_d)1 of 1 people found this helpfulHi,
the component is backed by a JS object so an API is there but I don't think there are methods specifically to let you control the component. As for the question - you can access files that have been selected by the user (or their JS representation) but you cannot access the files that have been put on the server if that's what you mean.
-
2. Re: JS API for RichFaces fileUpload
michal_d Nov 20, 2014 4:41 PM (in response to michpetrov)Hi,
thank you for your answer. I'm not entirely sure that I understood you correctly so maybe I will just write more specifically what I need to do.
I have a rich:fileUpload component with immediateUpload set to true and maxFilesQuantity = 1 so basically after user chooses file he wants to upload the upload is happening and the listener method is invoked. Now I need to add some JavaScript event handler in which I would be able to access this uploaded file (not to change anything, just retrieve some info about the file). Before or after the listener method, it doesn't matter. Is it possible?
-
3. Re: JS API for RichFaces fileUpload
michpetrov Nov 21, 2014 5:06 AM (in response to michal_d)1 of 1 people found this helpfulAh ok, that's not possible. The purpose of the component is to transfer files to the server, it doesn't care what happens with those files after they're delivered. You can ask the server about the files with an AJAX request, but you'd have to implement that yourself. Or you can process the file in a bean and then output the information, like we do in the showcase.
-
4. Re: JS API for RichFaces fileUpload
michal_d Nov 21, 2014 5:27 AM (in response to michpetrov)Ok, thank you for your answers.
-
5. Re: JS API for RichFaces fileUpload
michal_d Nov 25, 2014 7:58 AM (in response to michpetrov)Hi,
I would like to ask one more question about rich:fileupload. This use case which I described above concerns an image uploader. I need to process uploaded image in my bean but I need to display it to the user as well (before saving in database). In your showcase you use session scoped bean to achieve that. I don't want to use session scoped bean and with view scoped bean I can't use mediaoutput component. I managed to do a workaround in JavaScript but I need to access this uploaded image and you said it's impossible.
My question is: do you have idea how to solve this problem? Or maybe, could you be more specific about asking server about that file with an AJAX request? Any example?
-
6. Re: JS API for RichFaces fileUpload
michpetrov Nov 26, 2014 8:58 AM (in response to michal_d)If the file isn't saved anywhere and just exists in the memory I don't think you can get to it with JavaScript at all. If it was saved you'd have at least an URL to work with.