• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Exception in 2.1.6 when uploaded file size is greater than the maxSize

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been using 2.1.6 comfortably but have not been able to use the avatar feature due to multiple reasons.
First when i uploaded an avatar, there was no size check happening at fileUploadBase.java. So as a debug, i tried to set sizeMax property before upload. Now that is happening, but the SizeLimitExceededException exception that is thrown after the sizemax is hecked, s not handled anywhere, and as a result i get the error page. Should i revert the sizeMax setting that i have done. if yes, when does the size comparison actually happen, so that i can aviod users from uploading megabytes of objects, thus making my app heavy.

thanx in advance!
~pankaj

[originally posted on jforum.net by pankajvermani]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you're getting a NullPointerException, right? To fix that, create a directory named "tmp" in the root directory of your context and give it full write permissions

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rafael,

Its not the tmp folder issue. I have both tmp and upload created with the adequate persmissions. What i saw was that there is a code in class FileUploadBase:


However this sizeMax is not set (and is -1), so there's no size limit being checked. When i set this explicitly, the exception could not be handled gracefully, and i obviously received the error page.

I finally figured out the solution at my end. Now i'm checking the filesize not at this point but at AttachmentCommon, by doing a fileItem.get() and then checking the bytes. Dont knwo how graceful a solutiont hat is, but the application is behaving fine.

Regards
[originally posted on jforum.net by pankajvermani]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please post the changed code here?

Thank you

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in UserCommon, following code has been added:



this is after I included a few util files (the ImageProcessor as mentioned) which figure out if the extension for the avatar is a valid one. The same extention check has been added to AttachmentCommon as well inside the loop for each FileItem to be uploaded.
[originally posted on jforum.net by pankajvermani]
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic