Reputation: 59
i want to upload image upto 6mb in mysql. now i am using longblob to store image in mysql. but it can only store images less than 500kb. Here the code is working but cant't upload large image. any one help me out .. thank you ...
String sql = "INSERT INTO contacts (first_name, last_name, photo) values (?, ?, ?)";
PreparedStatement statement = db.con.prepareStatement(sql);
statement.setString(1, firstName);
statement.setString(2, lastName);
if (inputStream != null) {
statement.setBlob(3, inputStream);
}
int row = statement.executeUpdate();
Upvotes: 2
Views: 2190
Reputation: 681
choose one of the following blob types in your database to store large size images
Binary: Fixed size up to 8,000 bytes.
VarBinary(n): Variable size up to 8,000 bytes (n specifies the max size).
VarBinary(max): Variable size, limit of 2 GB.**
if it is server side error check this link click here
Upvotes: 2