commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knezevic, Mihael" <m.kneze...@porta.de>
Subject RE: [fileupload] Maximum size for upload?
Date Thu, 28 Jul 2005 06:56:51 GMT
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:mgrogan@mobilegolfers.net] 
> Sent: Thursday, July 28, 2005 8:49 AM
> To: Jakarta Commons Users List; mgrogan@mobilegolfers.net
> 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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message