Anyone know the how to pass long data through ajax. I need to pass the base 64 image string to php file. i didn’t pass
This is my code
var images = chart.getImageURI();
// alert(images);
$.ajax({
method : 'POST',
url : 'saveImage.php',
processData: true,
data : {
data : chart.getImageURI()
},
success: function (result) {
alert(result);
alert('image saved');
}
});
well, i think data is it’s so long So how to pass that data.
I know that the use of method ‘POST’ .
I would google file upload image to PHP.
Here is one of the links.
https://www.w3schools.com/php/php_file_upload.asp
What parameter is saveImage.php expecting the image string to belong to?
What is images
after the following line?
var images = chart.getImageURI();
In the following, why do you call this same function again and assign it to the data property?
data : {
data : chart.getImageURI()
},
Actually, i doing testing that parameter pass the value getting through the images variable. I try to pass that variable to data in ajax call.
//var images = chart.getImageURI();
// alert(images);
$.ajax({
method : 'POST',
url : 'saveImage.php',
processData: true,
data : {
data : chart.getImageURI()
},
success: function (result) {
alert(result);
alert('image saved');
}
});
chart.getImageURI()
This function return a string which base 64 png image string which i want save on the server in png file for that i use ajax. So, i want post that string to my function so that i can process that string and save on to server.
I got an error somthing like URI is too long.
Is the error in the browser console or is it generated from the php script?
1 Like
In the Browser console. and php side their is not getting data.
Is that possible to convert base 64 image string to png file, save on the server.any code for that or function in JavaScript.