I want to upload Base64 image to server . I am using jsp and js as front end client side and java as back end .
var imgData =imagesScanned.data;
JSON.stringify(imgData)
var fileShareDetails = {
pageMode : "SCAN_FILE_UPLOAD",
imgData:imgData,
};
var d = $.param(fileShareDetails);
$.ajax({
url: "folderNavigation.do?" + d,
dataType: 'JSON',
data: imgData,
type: 'POST',
success: function(data) {
alert("response is coming")
}
});
If i upload from this i am getting below error
Failed to load resource: net::ERR_CONNECTION_RESET http://localhost:9080/Initial/folderNavigation.do?pageMode=SCAN_FILE_UPLOAD…2FWi4XFMrY7Ukb5dqDgj7o%2FWo0VYySowSeckn%2BdK4XJmetKsdnNbFJkn%2F%2F2Q%3D%3 ......
Please somebody help me as i have stuck up with this from several hours.
You cannot put a huge parameter into the URL.
Put all the parameters, or at least the imgData
into the request body only.
$.ajax({
url: "folderNavigation.do?" + d, // remove the "+d"
dataType: 'JSON',
data: imgData, // this part goes into the body,
// maybe you want "fileShareDetails"
// instead of "imgData"
type: 'POST',
success: function(data) {
alert("response is coming")
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.