Hi Mihael,
I've checked the size of the array, it is 89K, which is about right. It is also definately being placed into a MEDIUMBLOB which I think is 2^24 bytes max. There shouldn't be a problem there. I'm wondering if it's a problem with setting the stream for the preparedStatement, i.e. //statement.setBinaryStream(1,inStream2,orig.length); // setBinaryStream no good ??
    statement.setBytes(1,orig);
Thanks,
Martin


Knezevic, Mihael wrote:

i definitly uploaded a file of more than 40mb via the fileupload lib. so the 
size shouldn't be the problem.

first i would check the length of the array orig after the following line:
byte[] orig= os2.toByteArray();

then if would double check the definition of the columns in the table.

good luck.

mk

-----Original Message-----
From: Martin Grogan [mailto:[EMAIL PROTECTED] Sent: Thursday, July 28, 2005 8:49 AM
To: Jakarta Commons Users List; [EMAIL PROTECTED]
Subject: [fileupload] Maximum size for upload?

Hi all,
Some time ago, I posted a question (and subsequently a code solution) relating to JPEG scaling. This issue has now been resolved, and I am working on storing images uploaded to a mySQL database as BLOBs (MEDIUMBLOB). It seems that when the image size is > 65535 bytes, the bottom of the image is chopped off, and I am left with an image that is exactly 65535 bytes. If anyone has any ideas on why this might be happening, and how I can resolve it, I would be grateful.
Many thanks,
Martin

Some of the code I'm using is here...
.............................. BufferedImage origImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); java.awt.Graphics2D graphics2D2 = origImage.createGraphics(); graphics2D2.setRenderingHint(java.awt.RenderingHints.KEY_INTER
POLATION,java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2D2.drawImage(image, 0, 0, imageWidth, imageHeight, null); // get output stream from image ByteArrayOutputStream os2= new ByteArrayOutputStream(); ImageIO.write(origImage,"jpeg",os2); byte[] orig= os2.toByteArray(); // setup input stream for blob ByteArrayInputStream inStream2= new ByteArrayInputStream(orig);
                   try
                   {
                       Class.forName( "com.mysql.jdbc.Driver");
Connection connection=DriverManager.getConnection("jdbc:mysql://localhost /gallery","gallery","gallery"); String query="INSERT INTO img (name, pic) VALUES ('"; query=query+"picture',";
                       query=query+"?"+")";
PreparedStatement statement = connection.prepareStatement(query); //statement.setBinaryStream(1,inStream2,orig.length); // doesn't seem to work either
                       statement.setBytes(1,orig);
                       ....................

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to