Answer the question
In order to leave comments, you need to log in
Send GET or POST base64 request from Javascript to PHP?
There is a String received using the function, the reader.readAsDataURL(blob)
size is somewhere around 500kb.
I need to send this string using the API from JS to PHP using XMLHttpRequest.
Everything is ready, except that this string is not transmitted (apparently the volume is large)
Smaller strings are passed
How can I transfer it?
Answer the question
In order to leave comments, you need to log in
In two steps (more economical!):
1. https://github.com/eligrey/FileSaver.js/
2. https://stackoverflow.com/questions/23511792/attac...
You can do it in one:
var xhr = new XMLHttpRequest();
xhr.open('POST', 'someURLForTheUpload', true); //my url had the ID of the item that the blob corresponded to
xhr.responseType = 'Blob';
xhr.setRequestHeader("x-csrf-token",csrf); //if you are doing CSRF stuff
xhr.onload = function(e) { /*irrelevant code*/ };
xhr.send(blob);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question