I have a Struts2 action that receives a string containing an image in Base64 and another string for the image name.
Everything works well for small sized images. But when I try to send a larger image, the Base64 and the image name strings are set to null in the action implementation.
In search for a solution I found that the default maximum size for the file upload is 2 MB. This limit can be increased with the following properties:
<constant name="struts.multipart.maxSize" value="104857600" />
<param name="maximumSize">52428800</param>
<param name="fileUpload.maximumSize">52428800</param>
However this is not working. Probably this implementation is not a file upload but a two string POST request.
Is there a way I can increase the size of the post request? Or the problem is something else?
public class GalleryAction  extends BaseAction {
private String imageBase64;
private String imageName;
...
public final String uploadOperation() throws Exception {
    if (this.imageBase64 == null || this.imageBase64.length() == 0
            || this.imageName == null || this.imageName.length() == 0) {
        throw new Exception("Invalid argument");
    }
    byte[] decodedBytes = Base64Decoder.decode2bytes(this.imageBase64);
    InputStream is = new ByteArrayInputStream(decodedBytes);
    Graphics graphics = MGraphics.insertImageToDataBase(this.imageName, is);
    // Issue server to sync image.
    RestUtils.syncImage(graphics.getId());
    JSONObject response = new JSONObject();
    response.put("statusCode", "0");
    jsonString  = response.toString();
    return JSON_RESPONSE;
}
...
}
EDIT: I forgot to publish the code for the image upload.
Gallery.prototype.upload = function(base64, imageName) {
var galleryObject = this;
galleryObject.loadingCallback(true);
$.post(this.urlBase + "/upload", {
    "imageBase64" : base64.match(/,(.*)$/)[1],
    "imageName" : imageName
}, function(data) {
    galleryObject.handlerErrorMessageCallback();
    galleryObject.loadingCallback(false);
    galleryObject.refreshImageGalleryCallback();
}, "json")
.fail(function() {
    galleryObject.handlerErrorMessageCallback("error.upload.image");
    galleryObject.loadingCallback(false);
});
}
 
    