I'm generating images on WP admin panel and saving it to Media Library. I was working perfectly few months ago. But now if i'm sending dataurl via ajax, i'm not receiving any answers from server a long time, and getting 400 error or 404 after. When i'm removing data url value from ajax call and trying to put string or array, it works ok.
Here is my ajax:
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
var dataURL = canvas.toDataURL();
var data = {
'action' : 'save_certificate',
'dataURL' : dataURL
};
jQuery.post(ajaxurl, data).done(function( response ) {
console.log(response);
}).fail(function(xhr, status, error) {
console.log(xhr);
console.log(status);
console.log(error);
}).catch(function(xhr, status, error) {
console.log(xhr);
console.log(status);
console.log(error);
});
and wp function
add_action( 'wp_ajax_save_certificate', 'save_certificate' );
function save_certificate(){
print('ok');
wp_die();
}
Post max size on wp config setted to 128MB UPDATED I've got, that i can send canvas which is less that 2 MB, or array which is less than that value, but why i cannot send bigger files?
jQuery Code:
jQuery(".add_to_queue").click(function(){
var product_id = jQuery('input[name="product_id"]').val();
var variation_id = jQuery('input[name="variation_id"]').val();
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {"action": "post_word_count", "productid":product_id, "variationid":variation_id},
success: function(response){
console.log(response);
}
});
});
WordPress Hook :
function post_word_count(){
echo "<pre>";
print_r($_POST['productid']);
exit();
}
add_action('wp_ajax_post_word_count', 'post_word_count');