-
1. Re: fileupload temp directory
sage.sam Mar 24, 2010 10:18 AM (in response to b_ravi_kiran)I don't know of a specific way to change where the files go by default; after all, it would need to be something platform independent. I can, perhaps, provide you some options.
Depending on your size limitation, server capacity and load, etc. you can consider setting createTempFiles=false on the tag. This will make the file data available to the listener only as byte[].
As an alternative, you can add a listener on your fileupload control and simply immediately move the file where you want it to go. You do this by specifying fileUploadListener="#{yourComponent.yourListener"} on the tag, where yourMethod has a signature
public void yourListener(UploadEvent event)
HTH
-
2. Re: fileupload temp directory
b_ravi_kiran Mar 24, 2010 10:59 AM (in response to sage.sam)I cannot use createTempFiles=false as the files being uploaded are large number of high resolution photos which will eat the systems memory. Yes I do have the fileUploadListener in my backing bean which moves it to a folder and then resizes it and places the resized image in another folder. However it still creates these files in the glassfish's config folder (which by the way will be the current working directory for all applications as glassfish starts from this server)
-
3. Re: fileupload temp directory
ilya_shaikovsky Mar 24, 2010 12:33 PM (in response to b_ravi_kiran)can't reproduce under tomcat and RF 3.3.3 snapshots. Will check additionally under glassfish also.
-
4. Re: fileupload temp directory
b_ravi_kiran Mar 24, 2010 11:59 PM (in response to ilya_shaikovsky)Hello Mr.Shaikovsky,
I did check with 3.3.3.CR1 also rich:fileupload still saves uploaded original files to glassfish's config folder. To make your testing a bit easier I have attached the backing bean, web.xml, 3 JSPs. Iam using STATE_SAVING_METHOD as server and my faces-config.xml has the following. Note that I use ajax keepalive for the uploaderBean (see galleryMain.jsp), galleryMain.jsp includes tabbedPanel.jsp which inturn includes richMediaUpload.jsp
<managed-bean>
<managed-bean-name>uploaderBean</managed-bean-name>
<managed-bean-class>com.wpni.gb.managed.beans.MediaUploadBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>galleryView</property-name>
<value>#{galleryView}</value>
</managed-property>
<managed-property>
<property-name>galleryService</property-name>
<value>#{galleryService}</value>
</managed-property>
<managed-property>
<property-name>properties</property-name>
<value>#{gbProperties}</value>
</managed-property>
</managed-bean>Kindly let me know what you find
Thanks,
Ravi Kiran Bhaskar
Lead Developer
Washington Post Digital
1150 15th Street NW, Washington, DC 20071
washingtonpost.com | mobile.twp.com-
code.zip 4.8 KB
-
-
5. Re: fileupload temp directory
ilya_shaikovsky Mar 25, 2010 12:05 PM (in response to b_ravi_kiran)We found the code which caused cration of the files in config folder:
File toResizeFile = new File(item.getFileName()); FileOutputStream stream = new FileOutputStream(toResizeFile); stream.write(bytes);
item.getFileName() returns just name of the file ("somepicture.jpg"). So it's created in current application working dir. And as you could check with System.getProperty("user.dir") - GlassFish has configs folder as working dir.
-
6. Re: fileupload temp directory
b_ravi_kiran Mar 25, 2010 6:24 PM (in response to ilya_shaikovsky)Yes Mr.Shaikovsky you are abosultely right. That was a brain fart on my end. sorry for posting non-richfaces issue.
Ravi Kiran Bhaskar