-
1. Re: rich:upload fileUploadListener not called for large files
michpetrov Jun 22, 2015 9:50 AM (in response to pradeepa.kadiyala)Are you getting any browser or server errors? What's your version of RichFaces?
-
2. Re: rich:upload fileUploadListener not called for large files
pradeepa.kadiyala Jun 22, 2015 10:20 AM (in response to michpetrov)Hi Michal!
We are using richFaces 4.3 version and as we moved further with testing, we found that it was working properly on our local machines but failed to run on the UAT and production servers. We are using JBOSS EAP 6.2 server.
Not getting any browser or server errors. It is just that for larger files than 100KB the event listener does not get called. -
3. Re: rich:upload fileUploadListener not called for large files
michpetrov Jun 22, 2015 11:17 AM (in response to pradeepa.kadiyala)If the listener isn't called it would mean that there is no file to process, but if you can get it to work on one server then the problem is probably with server settings. Servers may have their own setting for file transfers but I wouldn't expect it to be that low (and you should still get an upload error if that was the case).
-
4. Re: rich:upload fileUploadListener not called for large files
bhanugst2015 Jun 23, 2015 1:41 AM (in response to pradeepa.kadiyala)Hi Pradeep ,
any error you are seeing in console . It may be due to Hardware support also some times .
-
5. Re: rich:upload fileUploadListener not called for large files
pradeepa.kadiyala Jun 23, 2015 1:45 AM (in response to bhanugst2015)Hi Bhanu,
No error in the console. For files less than 100KB everything works fine. For files larger than 100KB the listener does not get fired and so not able to upload the file. Is it possible to restrict the file uplaod capacity from the server or the network?
FYI I am Pradeepa* not Pradeep
-
6. Re: rich:upload fileUploadListener not called for large files
bhanugst2015 Jun 23, 2015 1:51 AM (in response to pradeepa.kadiyala)Pradeep ,
The i guess its a Hardware related one / internal image file settings . Yes you can restrict the file size . Your compression method will be some thing like this :
public byte[] resizeImageAsJPG(byte[] pImageData, int pMaxWidth) throws IOException { // Create an ImageIcon from the image data ImageIcon imageIcon = new ImageIcon(pImageData); int width = imageIcon.getIconWidth(); int height = imageIcon.getIconHeight(); // If the image is larger than the max width, we need to resize it if (pMaxWidth > 0 && width > pMaxWidth) { // Determine the shrink ratio double ratio = (double) pMaxWidth / imageIcon.getIconWidth(); height = (int) (imageIcon.getIconHeight() * ratio); width = pMaxWidth; } if(width < 0 || height < 0) { return new byte[0]; } // Create a new empty image buffer to "draw" the resized image into BufferedImage bufferedResizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // Create a Graphics object to do the "drawing" Graphics2D g2d = bufferedResizedImage.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); // Draw the resized image g2d.drawImage(imageIcon.getImage(), 0, 0, width, height, null); g2d.dispose(); // Now our buffered image is ready // Encode it as a JPEG ByteArrayOutputStream encoderOutputStream = new ByteArrayOutputStream(); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(encoderOutputStream); encoder.encode(bufferedResizedImage); byte[] resizedImageByteArray = encoderOutputStream.toByteArray(); return resizedImageByteArray; } Hope this may help you .
-
7. Re: rich:upload fileUploadListener not called for large files
pradeepa.kadiyala Jun 23, 2015 4:41 AM (in response to bhanugst2015)Bhanu ,
We are having the upload as an identity or address proof and we support JPG pdf,png,all such formats. I am afraid but we cannot use the above method suggested by you.
As you said might be some internal issues, can u specify if what settings we might have changed.
Also we use apache tomcat 7.0.47 as the web server and our application is deployed on JBOSS EAP 6.2. On our local we have only the JBOSS server. -
8. Re: rich:upload fileUploadListener not called for large files
michpetrov Jun 23, 2015 4:54 AM (in response to bhanugst2015)If the problem is with the file handling listener not being called, I'm not sure how an image resizing method would help when you cannot use it.
pradeepa.kadiyala, check your server configuration for "max-post-size", but if that's not it I don't know where the problem is.
-
9. Re: rich:upload fileUploadListener not called for large files
bhanugst2015 Jun 23, 2015 7:57 AM (in response to pradeepa.kadiyala)Hi Pradeepa ,
we will be having 3 things here :
1. createTempfile
2. maxRequestSize
3. <web:multipart-filter disabled="true" /> in components.xml
Apart from this there is nothing which may go wrong according my view . Even if it is an address proof we can compress the size of the image by setting the default resolution . We had tried with ID Proof in our applications and it is working perfectly .maximum image width we had taken is 800 .
-
10. Re: rich:upload fileUploadListener not called for large files
pradeepa.kadiyala Jun 23, 2015 10:00 AM (in response to bhanugst2015)hi Bhanu,
The problem is we have the requirement to support all sorts of file types, so it isnt necessary that we have an image. It can also be a PDF, DOC etc.
As per your suggestions checked for all 3..
found 2 of them in our web.xml.<context-param>
<param-name>org.richfaces.fileUpload.createTempFiles</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
<param-value>52800000</param-value>
</context-param>
and the 3rd in components.xml
<web:multipart-filter disabled="true" />
still unable to fix the issue
-
11. Re: rich:upload fileUploadListener not called for large files
bhanugst2015 Jun 24, 2015 1:16 AM (in response to pradeepa.kadiyala)Hi Pradeepa ,
Iam figuring out from my end will let you know . Try this link . i think this may help :