-
1. Re: rich:fileUpload as part of form is not working
khaled_288 Jun 11, 2008 6:21 AM (in response to khaled_288)
if rich:fileUpload is not designed for this usage; what is the alternative solution for my need:
upload single image as a part of the form.
while the core JSF does not have such component. (there is no <h:inpuFile>
i need your help :) -
2. Re: rich:fileUpload as part of form is not working
ilya_shaikovsky Jun 11, 2008 6:26 AM (in response to khaled_288)We working under this right now. As alternative you could use t:inputFile.
-
3. Re: rich:fileUpload as part of form is not working
khaled_288 Jun 11, 2008 7:15 AM (in response to khaled_288)
thank you for fast response :) -
4. Re: rich:fileUpload as part of form is not working
kdcosta Jun 11, 2008 7:54 AM (in response to khaled_288)hi
I dono whether this is wht u needed.
wht i did was , i created a java class with two variable ie string fileName and one to store data.Also its setters and getters.
when the browse button is clicked, it enters the listener method , there set the filename and the data to the new java class we have created.
javaclassName.setFilename(); etc etc.
And then when the commandButton is clicked, get the fileName and the data from that java class.
ie javaclassName.getFileName(); etc.
try it.It worked for me. -
5. Re: rich:fileUpload as part of form is not working
khaled_288 Jun 11, 2008 8:34 AM (in response to khaled_288)kdcosta .. i did not get your idea
please could you help me with an example (code snippet)?
thanks :) -
6. Re: rich:fileUpload as part of form is not working
kdcosta Jun 11, 2008 9:42 AM (in response to khaled_288)hi
im sorry for that.<rich:fileUpload uploadData="#{createNewClient.uploadData}" id="logoImageInput" ajaxSingle="true" rendered="#{not createNewClient.created}" maxFilesQuantity="1" acceptedTypes="jpg, gif, png, bmp" immediate="true" listHeight="70px" fileUploadListener="#{createNewClient.uploadListener}" immediateUpload="true"> </rich:fileUpload>
Upon uploading , fileUploadListener will called. rt??
there u will get the file name of the upload file.
For example my listener is like thispublic void listener(org.richfaces.event.UploadEvent event) { try { event.getUploadItem().getData(); item = event.getUploadItem(); utility.setLogFilePath(item.getFileName()); fileData = event.getUploadItem().getFile(); utility.setFileData(this.fileData); } catch (Exception e) { System.out.println(this.getClass().getSimpleName()+"1006"+e.toString()); e.printStackTrace(); } }
I have created a Utility.java class and i have injected that class into my controller class.@Name("utility") @Scope(ScopeType.SESSION) public class Utility { String logFilePath; File fileData; }
Also its getter and setters.
And when the action of ur commandButton is called<h:commandButton value="#{msg.create}" action="#{createNewClient.create}" />
i mean in create method, u can get the filename and the filedata using
utility.getLogFilePath(),utility.getFileData()
and using the uploading code u can write the filedata.
i dono whether this is wht u needed.
or else just ignore it .
good luck -
7. Re: rich:fileUpload as part of form is not working
khaled_288 Jun 11, 2008 10:18 AM (in response to khaled_288)ahaaa now i got you .. so you are saving the uploaded file in the session scope.
I think about this but do you think it is right practice to save files in session ?:)
1- I think this probably cause memory problems specially under stress load.
2- what if the user access the same page from another browser and upload another file .. the old file will be overridden.
I think session is the not good place to store files :) -
8. Re: rich:fileUpload as part of form is not working
liulei1984 Aug 13, 2008 4:20 AM (in response to khaled_288)"ilya_shaikovsky" wrote:
We working under this right now. As alternative you could use t:inputFile.
In which version of RF will solve this problem?
appreciate!!!
I am really eager to know that.
Thanks for any reply. -
9. Re: rich:fileUpload as part of form is not working
liulei1984 Aug 13, 2008 4:23 AM (in response to khaled_288)I have traced the jira for this,but no hint
-
10. Re: rich:fileUpload as part of form is not working
andrei_exadel Aug 13, 2008 4:35 AM (in response to khaled_288)Liulei1984,
Can you specify in details the functionality you're eager?
You'd like to have only upload posibility with form?
Or you want to have upload progress information such in case by UPLOAD button?
Do you want to have STOP functionality in this case?
& etc.
Thanks. -
11. Re: rich:fileUpload as part of form is not working
liulei1984 Aug 13, 2008 4:51 AM (in response to khaled_288)"andrei_exadel" wrote:
Liulei1984,
Can you specify in details the functionality you're eager?
You'd like to have only upload posibility with form?
Or you want to have upload progress information such in case by UPLOAD button?
Do you want to have STOP functionality in this case?
& etc.
Thanks.
In my application(Useing Seam Framework), I just want to upload multi files at a time in one form. Not ajax style,but submit the files with the form.
what i want is just like below:
<h:form id="publish" enctype="multipart/form-data">
<rich:fileUpload uploadData="#{eventHome.files}"
maxFilesQuantity="5"
autoclear="false"
addControlLabel="æ·»åŠ å›¾ç‰‡"
uploadControlLabel="ä¸Šä¼ "
clearAllControlLabel="清除所有"
clearControlLabel="清除"
cancelEntryControlLabel="�消"
stopControlLabel="å�œæ¢"
stopEntryControlLabel="å�œæ¢" noDuplicate="true"
listHeight="150"
listWidth="425"
style="height:150;"
id="upload"
acceptedTypes="jpg, gif, png, bmp">
</rich:fileUpload>
<h:commandLink action="#{eventHome.persist()}">
</h:commandLink>
</h:form>
Once i hit the submit button, all the files data can be received in #{eventHome.files}.
Note: "eventHome" is stateless session bean.
Thanks for reply! -
12. Re: rich:fileUpload as part of form is not working
andrei_exadel Aug 13, 2008 7:03 AM (in response to khaled_288)We'll discuss this soon.
-
13. Re: rich:fileUpload as part of form is not working
liulei1984 Aug 13, 2008 7:59 AM (in response to khaled_288)"andrei_exadel" wrote:
We'll discuss this soon.
Appreciate!
I'm waiting for the solution.
If you can solve this prolem and release in Version 3.2.2, it will do me a great favor.
Thanks.
Any schedule or jira item comes out, let me know.
I will pay attention to it.
-
14. Re: rich:fileUpload as part of form is not working
andrei_exadel Aug 14, 2008 11:40 AM (in response to khaled_288)The JIRA issue filled: https://jira.jboss.org/jira/browse/RF-4209.
It will be included in 3.2.2 release.