07 October 2008

Java and PNG File Uploads

I've run into an issue where a Java 1.4 servlet is having trouble with some PNG files: If the memory size of the image (not the disk size) is greater than 5MB, it gives a codecLib error when trying to read it during an upload. The IrfanView image utility came in handy for this (Image > Information). Haven't found any info on this.

One solution: Use the FileUpload object's size property to at least ensure the disk size is below 1MB; perhaps this will prevent those images with even bigger memory sizes from hitting the server until a better solution is found.

No comments: