I want to save an image on a server by sending its properties via ajax.. In the JS I'm encoding the image in base64 before I send it (along with other parameters i need):
$.ajax({
type: 'POST',
url: 'PhotoSelect.aspx/GetData',
data: JSON.stringify({ action: "save", x: x, y: y, width: width, height: height, type: type, obj_id: obj_id, image: image, team: teamVal, jersey: jerseyVal, spot: spotVal }),
contentType: 'application/json; charset=utf-8',
dataType: 'json'
})
And i receive the request on server side by:
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public static JsonReturn GetData(string action, string x, string y, string width, string height, string type, string obj_id, string image, string team, string jersey, string spot)
{
//Process Image
}
Now the weird part is that this works (by this i mean it reaches the GetData function) for some images! When i attempt to send a smaller (or lower quality) image this works. When i attempt to send images that have really long base64 strings it doesnt reach the function..
Can anyone think of anything that might be wrong with this?