There are ways to perform the image upload if type=“file”. The requirement here is to send an image from image tag to server.
Cannot send by converting into base64. Due to size constrain.
<form id="form-url">
<image src=“/images/defaultImg.jpg” id=“testImg1”/>
<image src=“/images/defaultImg2.jpg” id=“testImg2”/>
<button>UPLOAD onClick=“</button>
</form>
The is how I make an Ajax call.
$.get(“/appUI/ImageServiceController", {
action : “imageCompare”,
firstImage:$(‘#testImg1’).attr('src');,
secondImage:$(‘#testImg2’).attr('src');,
}, function(res) {
alert(“success”);
}).fail( function(request, status, errorThrown) {
alert(“failed”);
}
})
}
How can I upload this image to server.
This is an X/Y problem.
If you serve the image from the same server you have, the image already on the server.
If you serve the image from another server, you have the URL
If the page that needs the image does not know the URL, then send the URL of the image to the server instead of trying to grab the image from the client