S
S
Sergey2015-10-08 19:56:24
PHP
Sergey, 2015-10-08 19:56:24

How to pass image data from base64 src attribute via AJAX and receive it in PHP?

How to pass image data from base64 src attribute via AJAX and receive it in PHP using imagecreatefromstring? If I just pass it as a regular variable, php gives out invalid data in imagecreatefromstring

var data64 = canvasImg.toDataURL("image/jpeg");
      
      $.post("/ajax", { base64: data64},
          function(data){
            alert(data);
          });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vista1x, 2015-10-08
@goodwin74

imagecreatefromstring(base64_decode($string))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question